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.

Best way to Loading Data from existing data

3 posts in General Discussion Last posting was on 2003-04-30 18:11:04.0Z
Richard Posted on 2003-04-29 19:03:34.0Z
From: "Richard" <Richardr@ldsinc.com>
Subject: Best way to Loading Data from existing data
Date: Tue, 29 Apr 2003 14:03:34 -0500
Lines: 52
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <Or$xRLoDDHA.314@forums-2-dub>
Newsgroups: ianywhere.public.general
NNTP-Posting-Host: lds253.ldsinc.com 66.6.104.253
Path: forums-1-dub!forums-master.sybase.com!forums-2-dub.sybase.com
Xref: forums-1-dub ianywhere.public.general:968
Article PK: 2962

Instead of have hundreds of rows of insert statements what is the best way
to load data from existing model of data. let me explain with a example

Tables: Users, Features

Existing data in Features Table looks like the following Note: that the
UserName is Default this is my model data that I want to copy back into the
same table

AutoID,Date_Added,Date_Edited,User_Added,User_Edited,Secured_Features_Link_C
ode,UserName,Security_Mask
1,'2003-04-10 12:53:03.567','2003-04-28
10:46:04.904','DBA','DBA',1,'Default',12
2,'2003-04-10 12:53:03.567','2003-04-28
10:46:04.951','DBA','DBA',2,'Default',12
3,'2003-04-10 12:53:03.567','2003-04-28
10:46:04.951','DBA','DBA',3,'Default',12
4,'2003-04-10 12:53:03.567','2003-04-28
10:46:04.951','DBA','DBA',4,'Default',12
5,'2003-04-10 12:53:03.567','2003-04-28
10:46:04.951','DBA','DBA',5,'Default',12
6,'2003-04-10 12:53:03.567','2003-04-28
10:46:04.966','DBA','DBA',6,'Default',12
7,'2003-04-10 12:53:03.567','2003-04-28
10:46:04.966','DBA','DBA',7,'Default',12
8,'2003-04-10 12:53:03.567','2003-04-28
10:46:04.966','DBA','DBA',8,'Default',12
9,'2003-04-10 12:53:03.567','2003-04-28
10:46:04.966','DBA','DBA',9,'Default',12
10,'2003-04-10 12:53:03.567','2003-04-28
10:46:04.966','DBA','DBA',10,'Default',12

Existing data in Users
AutoID,Date_Added,Date_Edited,User_Added,User_Edited,UserName,UserType
1,'2003-04-25 14:04:25.721','2003-04-25 14:04:25.721','DBA','DBA','LDS',1
2,'2003-04-25 14:04:25.721','2003-04-25 14:04:25.721','DBA','DBA','sandy',1
3,'2003-04-25 14:04:25.721','2003-04-25 14:04:25.721','DBA','DBA','dant',1
4,'2003-04-25 14:04:25.721','2003-04-25 14:04:25.721','DBA','DBA','djt',1
5,'2003-04-25 14:04:25.721','2003-04-25 14:04:25.721','DBA','DBA','dan',1
6,'2003-04-25 14:04:25.721','2003-04-25
14:04:25.721','DBA','DBA','testuser',1


Again I want to use my model data and join my users from my users table to
insert new records for each user with the model data. The only field that
would differ from each would be the UserName field.


Thanks!
Richard


Robert Waywell Posted on 2003-04-30 12:57:43.0Z
From: "Robert Waywell" <rwaywell@ianywhere.com>
References: <Or$xRLoDDHA.314@forums-2-dub>
Subject: Re: Best way to Loading Data from existing data
Date: Wed, 30 Apr 2003 08:57:43 -0400
Lines: 88
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Message-ID: <#525EixDDHA.62@forums-1-dub>
Newsgroups: ianywhere.public.general
NNTP-Posting-Host: rwaywell-pc.sybase.com 172.31.143.74
Path: forums-1-dub!forums-master.sybase.com!forums-1-dub.sybase.com
Xref: forums-1-dub ianywhere.public.general:970
Article PK: 2960

Take a look at the LOAD TABLE, INPUT and INSERT ... SELECT statements as a
starting point. If all of the data is currently in a single database, then
the INSERT ... SELECT statement is likely the one you want. If some of the
data is in a file outside the database then the LOAD TABLE or INPUT
statement will be the right one. If the data is in 2 separate databases then
you will likely want the INSERT but you will also need to create a Proxy
table.

--
-----------------------------------------------
Robert Waywell
Sybase Adaptive Server Anywhere Developer - Version 8
Sybase Certified Professional

Sybase's iAnywhere Solutions

Please respond ONLY to newsgroup

EBF's and Patches: http://downloads.sybase.com
choose SQL Anywhere Studio >> change 'time frame' to all

To Submit Bug Reports: http://casexpress.sybase.com/cx/cx.stm

SQL Anywhere Studio Supported Platforms and Support Status
http://my.sybase.com/detail?id=1002288

Whitepapers, TechDocs, and bug fixes are all available through the iAnywhere
Developer Community at www.ianywhere.com/developer

"Richard" <Richardr@ldsinc.com> wrote in message
news:Or$xRLoDDHA.314@forums-2-dub...
> Instead of have hundreds of rows of insert statements what is the best way
> to load data from existing model of data. let me explain with a example
>
> Tables: Users, Features
>
> Existing data in Features Table looks like the following Note: that the
> UserName is Default this is my model data that I want to copy back into
the
> same table
>
>
AutoID,Date_Added,Date_Edited,User_Added,User_Edited,Secured_Features_Link_C
> ode,UserName,Security_Mask
> 1,'2003-04-10 12:53:03.567','2003-04-28
> 10:46:04.904','DBA','DBA',1,'Default',12
> 2,'2003-04-10 12:53:03.567','2003-04-28
> 10:46:04.951','DBA','DBA',2,'Default',12
> 3,'2003-04-10 12:53:03.567','2003-04-28
> 10:46:04.951','DBA','DBA',3,'Default',12
> 4,'2003-04-10 12:53:03.567','2003-04-28
> 10:46:04.951','DBA','DBA',4,'Default',12
> 5,'2003-04-10 12:53:03.567','2003-04-28
> 10:46:04.951','DBA','DBA',5,'Default',12
> 6,'2003-04-10 12:53:03.567','2003-04-28
> 10:46:04.966','DBA','DBA',6,'Default',12
> 7,'2003-04-10 12:53:03.567','2003-04-28
> 10:46:04.966','DBA','DBA',7,'Default',12
> 8,'2003-04-10 12:53:03.567','2003-04-28
> 10:46:04.966','DBA','DBA',8,'Default',12
> 9,'2003-04-10 12:53:03.567','2003-04-28
> 10:46:04.966','DBA','DBA',9,'Default',12
> 10,'2003-04-10 12:53:03.567','2003-04-28
> 10:46:04.966','DBA','DBA',10,'Default',12
>
> Existing data in Users
> AutoID,Date_Added,Date_Edited,User_Added,User_Edited,UserName,UserType
> 1,'2003-04-25 14:04:25.721','2003-04-25 14:04:25.721','DBA','DBA','LDS',1
> 2,'2003-04-25 14:04:25.721','2003-04-25
14:04:25.721','DBA','DBA','sandy',1
> 3,'2003-04-25 14:04:25.721','2003-04-25 14:04:25.721','DBA','DBA','dant',1
> 4,'2003-04-25 14:04:25.721','2003-04-25 14:04:25.721','DBA','DBA','djt',1
> 5,'2003-04-25 14:04:25.721','2003-04-25 14:04:25.721','DBA','DBA','dan',1
> 6,'2003-04-25 14:04:25.721','2003-04-25
> 14:04:25.721','DBA','DBA','testuser',1
>
>
> Again I want to use my model data and join my users from my users table to
> insert new records for each user with the model data. The only field that
> would differ from each would be the UserName field.
>
>
> Thanks!
> Richard
>
>


Richard Posted on 2003-04-30 18:11:04.0Z
From: Richard
Date: Wed, 30 Apr 2003 14:11:04 -0400
Newsgroups: ianywhere.public.general
Subject: Re: Best way to Loading Data from existing data
Message-ID: <A4640762C6A785C00063E3BE85256D18.004BC22485256D18@webforums>
References: <Or$xRLoDDHA.314@forums-2-dub> <#525EixDDHA.62@forums-1-dub>
Lines: 12
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Path: forums-1-dub!forums-master.sybase.com!webforums.sybase.com!news
Xref: forums-1-dub ianywhere.public.general:973
Article PK: 3325

Thanks Robert,

Here is what I came up with...

INSERT INTO SVUser
(LinkCode,UserName, MaskValue)
SELECT svu.LinkCode,au.UserName, svu.UserName
FROM SVUser as svu
INNER JOIN DBA.Adm_Users as au ON (au.UserName <> svu.UserName)
WHERE svu.UserName = 'Default'

Richard