Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
i am executing this scripts in sql server2000SELECT'INSERT into temp values(data1, data2, data3)' + 'SELECT ' + CONVERT(VARCHAR(20), temp2.data1) + ', ' + CONVERT(VARCHAR(20), temp2.data2) + ', ' + '''' + CONVERT(VARCHAR(20), temp2.data3) + ''''FROM temp, temp2order by temp2.data1now my table temp and temp2 both has folowing fields and data typedata1 intdata2 intdata3 varchar(20)befor execution i have 0 records in temp and 10 records in temp2.this scripts supposed to add all 10 records from temp2 to temp but it does nothing. evevn it is not giving error too.
SamC
White Water Yakist
3467 Posts
Posted - 2006-01-24 : 17:48:24
You should not quote the T-SQL. Looks like the SQL was taken from an EXEC and inserted in a SELECT.Try
INSERT INTO MyTable (cola, colb, colc) SELECT resulta, resultb, resultc FROM MyTable
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)