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 |
|
misterraj
Yak Posting Veteran
94 Posts |
Posted - 2007-07-17 : 02:47:18
|
HI all, I have a table (eg) having two columns col1 and col2 having 100 rows/values.i want to write a select statement, which when executed would result in Insert statements for the program, here in the case as tehre are 100 rows it should give 100 insert statements. select 'Insert into table (' ??????????any help would be appreciated. |
|
|
aravindt77
Posting Yak Master
120 Posts |
Posted - 2007-07-17 : 03:14:00
|
| Hi,Plz do check with the following SQLSELECT 'INSERT INTO <NEW TABLE> (col1 , col2) VALUES(' + CAST(col1 AS VARCHAR(4)) + ',''' + CAST(RTRIM(col2) AS VARCHAR(10)) + ''')'FROM <SOURCE TABLE> |
 |
|
|
misterraj
Yak Posting Veteran
94 Posts |
Posted - 2007-07-17 : 03:20:31
|
| that worked nice aravind, thanks! |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|