Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Very new to Sybase. HELPP!!!

5 posts in General Discussion Last posting was on 2004-03-11 10:55:49.0Z
janice Posted on 2004-03-10 08:28:14.0Z
Sender: 2aa2.404ecebd.1804289383@sybase.com
From: janice
Newsgroups: ianywhere.public.general
Subject: Very new to Sybase. HELPP!!!
X-Mailer: WebNews to Mail Gateway v1.1s
Message-ID: <404ed24e.2ab8.846930886@sybase.com>
X-Original-NNTP-Posting-Host: 10.22.241.42
X-Original-Trace: 10 Mar 2004 00:31:10 -0800, 10.22.241.42
Lines: 24
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 10 Mar 2004 00:28:08 -0800, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 10 Mar 2004 00:28:14 -0800
X-Trace: forums-1-dub 1078907294 10.22.108.75 (10 Mar 2004 00:28:14 -0800)
X-Original-Trace: 10 Mar 2004 00:28:14 -0800, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2761
Article PK: 6233

Dear Sir/Mdm,
I am very new to Sybase Interactive SQL. I am trying to
migrate the data from existing database to the new database.
How can I do so?
I am planning to select the table (all fields) and export
to temporary file, then from the temporary file, import to
the new database. Is there any better way to do?
how can I assign the path to export/import(ie:
c:/Export.dbf) to a variable? example:
SET export_var = 'c:\Test\test2.dbf';

SELECT *
FROM "RSSsa"."TBAPPUser";
OUTPUT TO export_var;

SELECT *
FROM "RSSsa"."TBAPPParam";
OUTPUT TO export_var;

Can this be done. Hope to hear from you soon and thank you
in advance.

Rgrds,
Janice


Breck Carter [TeamSybase] Posted on 2004-03-10 11:52:30.0Z
From: "Breck Carter [TeamSybase]" <NOSPAM__bcarter@risingroad.com>
Newsgroups: ianywhere.public.general
Subject: Re: Very new to Sybase. HELPP!!!
Organization: RisingRoad Professional Services
Reply-To: NOSPAM__bcarter@risingroad.com
Message-ID: <f6vt4015gv4k4ujouvhudkv6ko9j2abdiq@4ax.com>
References: <404ed24e.2ab8.846930886@sybase.com>
X-Newsreader: Forte Agent 2.0/32.640
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: bcarter.sentex.ca
X-Original-NNTP-Posting-Host: bcarter.sentex.ca
Date: 10 Mar 2004 03:52:30 -0800
X-Trace: forums-1-dub 1078919550 64.7.134.118 (10 Mar 2004 03:52:30 -0800)
X-Original-Trace: 10 Mar 2004 03:52:30 -0800, bcarter.sentex.ca
Lines: 57
X-Authenticated-User: TeamPS
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2762
Article PK: 6231

Welcome!

ISQL is a client appliction that happens to process some commands itself, as opposed to passing them
on to the database engine. OUTPUT is one of those commands; it is processed by ISQL, whereas SET and
SELECT are both passed to the engine. ISQL itself does not have any mechanism for declaring
variables so that's why you're technique won't work.

However, the UNLOAD SELECT statement can be used to do (almost) the same thing; it runs on the
engine so you can use variables. The only wrinkle is that UNLOAD SELECT expects a string literal
filespec, but EXECUTE IMMEDIATE may be used to get around that.

Also, I suggest the default FORMAT ASCII instead of dBase format (which is only available with
OUTPUT).

BEGIN
DECLARE @unload LONG VARCHAR;
SET @unload = 'UNLOAD TABLE RSSsa.TBAPPUser TO ''c:\\Test\\test2.txt''';
EXECUTE IMMEDIATE WITH ESCAPES OFF @unload;
END;

On the other end, LOAD TABLE may be used to reverse the operation.

Breck

On 10 Mar 2004 00:28:14 -0800, janice wrote:

>Dear Sir/Mdm,
> I am very new to Sybase Interactive SQL. I am trying to
>migrate the data from existing database to the new database.
>How can I do so?
> I am planning to select the table (all fields) and export
>to temporary file, then from the temporary file, import to
>the new database. Is there any better way to do?
> how can I assign the path to export/import(ie:
>c:/Export.dbf) to a variable? example:
> SET export_var = 'c:\Test\test2.dbf';
>
> SELECT *
> FROM "RSSsa"."TBAPPUser";
> OUTPUT TO export_var;
>
> SELECT *
> FROM "RSSsa"."TBAPPParam";
> OUTPUT TO export_var;
>
>Can this be done. Hope to hear from you soon and thank you
>in advance.
>
>Rgrds,
>Janice

--
SQL Anywhere Studio 9 Developer's Guide
Buy the book: http://www.amazon.com/exec/obidos/ASIN/1556225067/risingroad-20
bcarter@risingroad.com
Mobile and Distributed Enterprise Database Applications
www.risingroad.com


janice Posted on 2004-03-11 01:42:16.0Z
Sender: 37c1.404fc389.1804289383@sybase.com
From: janice
Newsgroups: ianywhere.public.general
Subject: Re: Very new to Sybase. HELPP!!!
X-Mailer: WebNews to Mail Gateway v1.1s
Message-ID: <404fc4ac.37cf.846930886@sybase.com>
References: <404ed24e.2ab8.846930886@sybase.com><f6vt4015gv4k4ujouvhudkv6ko9j2abdiq@4ax.com>
X-Original-NNTP-Posting-Host: 10.22.241.42
X-Original-Trace: 10 Mar 2004 17:45:16 -0800, 10.22.241.42
Lines: 76
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 10 Mar 2004 17:42:06 -0800, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 10 Mar 2004 17:42:16 -0800
X-Trace: forums-1-dub 1078969336 10.22.108.75 (10 Mar 2004 17:42:16 -0800)
X-Original-Trace: 10 Mar 2004 17:42:16 -0800, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2769
Article PK: 6238

Hi,
Thanks for the reply. It helps alot. What if the existing
table (in the old database) has lesser/more fields than the
new table (in the new database)? How should I write the
programme to ensure that the data will be migrated to the
correct fields and the empty fields will remain?

Thanks in advance,
Janice

> Welcome!
>
> ISQL is a client appliction that happens to process some
> commands itself, as opposed to passing them on to the
> database engine. OUTPUT is one of those commands; it is
> processed by ISQL, whereas SET and SELECT are both passed
> to the engine. ISQL itself does not have any mechanism for
> declaring variables so that's why you're technique won't
> work.
>
> However, the UNLOAD SELECT statement can be used to do
> (almost) the same thing; it runs on the engine so you can
> use variables. The only wrinkle is that UNLOAD SELECT
> expects a string literal filespec, but EXECUTE IMMEDIATE
> may be used to get around that.
>
> Also, I suggest the default FORMAT ASCII instead of dBase
> format (which is only available with OUTPUT).
>
> BEGIN
> DECLARE @unload LONG VARCHAR;
> SET @unload = 'UNLOAD TABLE RSSsa.TBAPPUser TO
> ''c:\\Test\\test2.txt''';
> EXECUTE IMMEDIATE WITH ESCAPES OFF @unload;
> END;
>
> On the other end, LOAD TABLE may be used to reverse the
> operation.
>
> Breck
>
> On 10 Mar 2004 00:28:14 -0800, janice wrote:
>
> >Dear Sir/Mdm,
> > I am very new to Sybase Interactive SQL. I am trying
> to >migrate the data from existing database to the new
> database. >How can I do so?
> > I am planning to select the table (all fields) and
> export >to temporary file, then from the temporary file,
> import to >the new database. Is there any better way to
> > do? how can I assign the path to export/import(ie:
> >c:/Export.dbf) to a variable? example:
> > SET export_var = 'c:\Test\test2.dbf';
> >
> > SELECT *
> > FROM "RSSsa"."TBAPPUser";
> > OUTPUT TO export_var;
> >
> > SELECT *
> > FROM "RSSsa"."TBAPPParam";
> > OUTPUT TO export_var;
> >
> >Can this be done. Hope to hear from you soon and thank
> you >in advance.
> >
> >Rgrds,
> >Janice
>
> --
> SQL Anywhere Studio 9 Developer's Guide
> Buy the book:
>
http://www.amazon.com/exec/obidos/ASIN/1556225067/risingroad-20
> bcarter@risingroad.com
> Mobile and Distributed Enterprise Database Applications
> www.risingroad.com


Breck Carter [TeamSybase] Posted on 2004-03-11 10:55:49.0Z
From: "Breck Carter [TeamSybase]" <NOSPAM__bcarter@risingroad.com>
Newsgroups: ianywhere.public.general
Subject: Re: Very new to Sybase. HELPP!!!
Organization: RisingRoad Professional Services
Reply-To: NOSPAM__bcarter@risingroad.com
Message-ID: <l7h050ps2oamcn0l7hilq2bhbfj6p408kg@4ax.com>
References: <404ed24e.2ab8.846930886@sybase.com><f6vt4015gv4k4ujouvhudkv6ko9j2abdiq@4ax.com> <404fc4ac.37cf.846930886@sybase.com>
X-Newsreader: Forte Agent 2.0/32.640
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Original-NNTP-Posting-Host: bcarter.sentex.ca
X-Original-Trace: 11 Mar 2004 02:58:50 -0800, bcarter.sentex.ca
Lines: 91
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 11 Mar 2004 02:55:37 -0800, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 11 Mar 2004 02:55:49 -0800
X-Trace: forums-1-dub 1079002549 10.22.108.75 (11 Mar 2004 02:55:49 -0800)
X-Original-Trace: 11 Mar 2004 02:55:49 -0800, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2770
Article PK: 6236

The UNLOAD SELECT statement lets you pick and choose the columns, the column order, etcetera, when
producing the output file; i.e., if you can SELECT a result set from the old table that looks like
the row layout of the new table, you are all set. FWIW you can even call CAST to convert data types.

Breck

On 10 Mar 2004 17:42:16 -0800, janice wrote:

>Hi,
> Thanks for the reply. It helps alot. What if the existing
>table (in the old database) has lesser/more fields than the
>new table (in the new database)? How should I write the
>programme to ensure that the data will be migrated to the
>correct fields and the empty fields will remain?
>
>Thanks in advance,
>Janice
>
>> Welcome!
>>
>> ISQL is a client appliction that happens to process some
>> commands itself, as opposed to passing them on to the
>> database engine. OUTPUT is one of those commands; it is
>> processed by ISQL, whereas SET and SELECT are both passed
>> to the engine. ISQL itself does not have any mechanism for
>> declaring variables so that's why you're technique won't
>> work.
>>
>> However, the UNLOAD SELECT statement can be used to do
>> (almost) the same thing; it runs on the engine so you can
>> use variables. The only wrinkle is that UNLOAD SELECT
>> expects a string literal filespec, but EXECUTE IMMEDIATE
>> may be used to get around that.
>>
>> Also, I suggest the default FORMAT ASCII instead of dBase
>> format (which is only available with OUTPUT).
>>
>> BEGIN
>> DECLARE @unload LONG VARCHAR;
>> SET @unload = 'UNLOAD TABLE RSSsa.TBAPPUser TO
>> ''c:\\Test\\test2.txt''';
>> EXECUTE IMMEDIATE WITH ESCAPES OFF @unload;
>> END;
>>
>> On the other end, LOAD TABLE may be used to reverse the
>> operation.
>>
>> Breck
>>
>> On 10 Mar 2004 00:28:14 -0800, janice wrote:
>>
>> >Dear Sir/Mdm,
>> > I am very new to Sybase Interactive SQL. I am trying
>> to >migrate the data from existing database to the new
>> database. >How can I do so?
>> > I am planning to select the table (all fields) and
>> export >to temporary file, then from the temporary file,
>> import to >the new database. Is there any better way to
>> > do? how can I assign the path to export/import(ie:
>> >c:/Export.dbf) to a variable? example:
>> > SET export_var = 'c:\Test\test2.dbf';
>> >
>> > SELECT *
>> > FROM "RSSsa"."TBAPPUser";
>> > OUTPUT TO export_var;
>> >
>> > SELECT *
>> > FROM "RSSsa"."TBAPPParam";
>> > OUTPUT TO export_var;
>> >
>> >Can this be done. Hope to hear from you soon and thank
>> you >in advance.
>> >
>> >Rgrds,
>> >Janice
>>
>> --
>> SQL Anywhere Studio 9 Developer's Guide
>> Buy the book:
>>
>http://www.amazon.com/exec/obidos/ASIN/1556225067/risingroad-20
>> bcarter@risingroad.com
>> Mobile and Distributed Enterprise Database Applications
>> www.risingroad.com

--
SQL Anywhere Studio 9 Developer's Guide
Buy the book: http://www.amazon.com/exec/obidos/ASIN/1556225067/risingroad-20
bcarter@risingroad.com
Mobile and Distributed Enterprise Database Applications
www.risingroad.com


Greg Fenton Posted on 2004-03-10 17:48:28.0Z
From: Greg Fenton <greg.fenton_NOSPAM_@ianywhere.com>
Organization: iAnywhere Solutions Inc.
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113 MultiZilla/1.6.2.0c
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: ianywhere.public.general
Subject: Re: Very new to Sybase. HELPP!!!
References: <404ed24e.2ab8.846930886@sybase.com>
In-Reply-To: <404ed24e.2ab8.846930886@sybase.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-Original-NNTP-Posting-Host: gfenton-xp.sybase.com
Message-ID: <404f559f$1@forums-2-dub>
X-Original-Trace: 10 Mar 2004 09:51:27 -0800, gfenton-xp.sybase.com
Lines: 24
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 10 Mar 2004 09:48:19 -0800, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 10 Mar 2004 09:48:28 -0800
X-Trace: forums-1-dub 1078940908 10.22.108.75 (10 Mar 2004 09:48:28 -0800)
X-Original-Trace: 10 Mar 2004 09:48:28 -0800, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:2766
Article PK: 6237


janice wrote:
> I am planning to select the table (all fields) and export
> to temporary file, then from the temporary file, import to
> the new database. Is there any better way to do?

Please, always post the verison and build number of ASA that you are using.

Also, it would be helpful to know the particulars of the database you
are migrating from and of the one you are migrating to.

For ASA 8.x and 9.x, you might consider using the Migration Wizard in
Sybase Central or the sa_migrate() stored procedure in ASA itself.

For more information see the online documentation that ships with ASA.

Hope this helps,
greg.fenton
--
Greg Fenton
Consultant, Solution Services, iAnywhere Solutions
--------
Visit the iAnywhere Solutions Developer Community
Whitepapers, TechDocs, Downloads
http://www.ianywhere.com/developer/