dbTalk Databases Forums  

Loops in Sql queries in DTS to insert data in to a table

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Loops in Sql queries in DTS to insert data in to a table in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
aslamCS@gmail.com
 
Posts: n/a

Default Loops in Sql queries in DTS to insert data in to a table - 08-15-2006 , 11:15 PM






I used the following SQL query to insert data into another table using
DTS connection. I thought that following will insert the rows from a
table 10 times into the destination database. However, insertion is
done only once.


DECLARE @count integer
SET @count = 0 WHILE @count
< 10
begin
SET @count = @count + 1


SELECT *

FROM Categories

end


Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Loops in Sql queries in DTS to insert data in to a table - 08-16-2006 , 12:53 AM






I am not sure what a SQL Connection is. Are you using an ExecuteSQL task or
a DataPump task?

Is the source and destination on the same server? If they are then it would
be best to write the INSERT here as well.

In DTS You could also loop over the same row 10 times in a Script transform
and insert a row every time if you wished.

The use of * is generally not recommended as when table definitions change
the query could break and also you can potentially be bringing back a lot
more rows than you need to.



--


Allan Mitchell
Konesans Ltd
T +44 7966 476 572
F +44 2071 008 479
http://www.konesans.com



<aslamCS (AT) gmail (DOT) com> wrote

Quote:
I used the following SQL query to insert data into another table using
DTS connection. I thought that following will insert the rows from a
table 10 times into the destination database. However, insertion is
done only once.


DECLARE @count integer
SET @count = 0 WHILE @count
10
begin
SET @count = @count + 1


SELECT *

FROM Categories

end




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.