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
 Script Library
 scripts to insert or create table

Author  Topic 

Anup Shah
Starting Member

14 Posts

Posted - 2006-01-24 : 21:45:03
i am executing this scripts in sql server2000

SELECT
'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, temp2
order by temp2.data1


now my table temp and temp2 both has folowing fields and data type

data1 int
data2 int
data3 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.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-01-24 : 21:49:04
Don't quite understand what your script is doing. Can't you do this directly ?
insert into temp (data1, data2, data3)
select data1, data2, data3
from temp2


----------------------------------
'KH'

I do work from home but I don't do homework
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-01-24 : 22:01:21
Duplicate post:
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=60791

Do not post your question more than once.

The Script Library forum is not a place to post SQL question topics.





CODO ERGO SUM
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-01-24 : 22:05:05
Sam has already reply on this post http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=60791 at 17:48. Why the need to create a new post at 21:45 ?
If you still have any problem, please reply to the original post.

----------------------------------
'KH'

I do work from home but I don't do homework
Go to Top of Page

Anup Shah
Starting Member

14 Posts

Posted - 2006-01-24 : 22:44:31
sorry guies
that will not happen again
I apologies for that.
Go to Top of Page
   

- Advertisement -