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.
Author |
Topic |
saidev
Posting Yak Master
101 Posts |
Posted - 2006-08-17 : 17:15:24
|
Hi Guys,i have a table called tbl A, and there is are 4 columns. Here is the Datatbl A1 2 3 40 0 0 0 0 0 9 00 0 0 0what i want is i want to insert '9' from column 3 to another table as a first column in all the rows. It should be like thistbl B1 2 3 49 0 0 09 0 0 09 0 0 0can you guys help me with the Query.Thanks |
|
Gopi Nath Muluka
Starting Member
22 Posts |
Posted - 2006-08-17 : 18:55:58
|
I didn't understand your problem clearly Try this, insert into tblB select col3,0,0,0 from tblA where col3=9union allselect col3,0,0,0 from tblA where col3=9union allselect col3,0,0,0 from tblA where col3=9 |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-08-17 : 20:23:13
|
[code]insert into tblB (col1, col2, col3, col4)select a.col3, a.col1, a.col2, a.col4from tblA a cross join tblA aawhere a.col3 = 9[/code] KH |
 |
|
|
|
|
|
|