SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 Script Library
 scripts to insert or create table
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Anup Shah
Starting Member

USA
14 Posts

Posted - 01/24/2006 :  21:45:03  Show Profile  Reply with Quote
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)

Singapore
17638 Posts

Posted - 01/24/2006 :  21:49:04  Show Profile  Reply with Quote
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)

USA
7020 Posts

Posted - 01/24/2006 :  22:01:21  Show Profile  Reply with Quote
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)

Singapore
17638 Posts

Posted - 01/24/2006 :  22:05:05  Show Profile  Reply with Quote
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

USA
14 Posts

Posted - 01/24/2006 :  22:44:31  Show Profile  Reply with Quote
sorry guies
that will not happen again
I apologies for that.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000