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
 Unsolved query

Author  Topic 

susan_151615
Yak Posting Veteran

99 Posts

Posted - 2011-04-11 : 07:08:10
I have atable TEst with fields as follows
(rowid,processid,errorcode1,errorcode2,errorcode3)

Sample values for Test table:

RowId ProcessID ErrorCode1 ErrorCode2 ErrorCode3
1 2 cd1 cd2 cd3

i need to insert values from this table into another table
test2 which has fields as follows(rowid,processis,error)

Now i want a query which will yield result as follows for the test 2 table when i insert value from test table:

Result:

RowId ProcessID Error
1 2 cd1
2 2 cd2
3 2 cd3

Here rowid ia auto incremented column.
I tried using PIVOT/CTE operator but it didnt yield the result i wanted.

Without using cross joins and union operators will it be possible to yield this result
Can anyone help me in this




susan

raghuveer125
Constraint Violating Yak Guru

285 Posts

Posted - 2011-04-11 : 07:23:26
Ok your columns are fixed here in 1st table Test?

Raghu' S
Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-04-11 : 07:33:05
Looks like this is a duplicate posting of http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=159291
Go to Top of Page

susan_151615
Yak Posting Veteran

99 Posts

Posted - 2011-04-11 : 07:38:36
yes raghu columns are fixed

susan
Go to Top of Page
   

- Advertisement -