Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to create NEW SEQ number and migrate

Author  Topic 

awalsql
Starting Member

11 Posts

Posted - 2008-09-18 : 22:53:48
How to create NEW SEQ number and migrate in this situation?
In the Source table each order#
has two sets of comments: DATA SET1 and DATA SET2.
I need to migrate this into a new table with NEW SEQ.
In the destination table
I have two Comment fields and two Flag Fields
Please help

Actual Table
Order#__OLD Seq__Comment(25)______________Flag
001_____1________So VP____________________DataSet1
001_____2________Complete Today___________DataSet1
001_____1________Order22__________________DataSet2
001_____2________Dispatch today___________DataSet2
002_____1________Group4___________________DataSet1
002_____2________supply will be___________DataSet1
002_____3________processsed_______________DataSet1
002_____1________So#555 rlsd_____________DataSet2

Destination Table
Ordr#_NewSq_Com1(Chr25)_Com2(chr25)_____Flg1_______Flg2
001____1____So Vp_______Complete today__DataSet1___DataSet1
001____2____Order22_____Dispatch today__DataSet2___DataSet2
002____1____Group4______Supply will be__DataSet1___DataSet1
002____2____processed___So#555 rlsd____DataSet1___DataSet2

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-09-19 : 01:13:21
if you are using SQL Server 2005 use the row_number() function


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

awalsql
Starting Member

11 Posts

Posted - 2008-09-19 : 09:03:55
Unfortunately, I am using SQl2000
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2008-09-19 : 09:35:51
quote:
Originally posted by khtan

if you are using SQL Server 2005 use the row_number() function


KH
[spoiler]Time is always against us[/spoiler]





Did you read this?

That won't help...you are looking to crosstab this...but you kinda need to know which values for order number is "first"..is there a dayetime column on the row?

For example, in your Order#001, how do you know the pairs belong to each other...it get's worse if S3q > 2



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-19 : 09:39:58
is there a field which contain unique values in yourtable?
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2008-09-19 : 09:46:42
quote:
Originally posted by visakh16

is there a field which contain unique values in yourtable?



Why does that matter here?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-09-19 : 23:25:24
Why do you want to un-normalized your table ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -