dbTalk Databases Forums  

please recommend best way to accomplish task on various sources

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


Discuss please recommend best way to accomplish task on various sources in the microsoft.public.sqlserver.dts forum.



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

Default please recommend best way to accomplish task on various sources - 06-21-2005 , 10:39 AM






Hi,
I'm trying to perform an INSERT that I can do currently using osql, but
I need to make some changes and thought that putting into a DTS would
be a good idea (instead of a scheduled task like the osql is now).

What I like about the osql is I connect to various servers using
variables, how would I accomplish this with DTS? I'm barely able to
script! I'm posting as I haven't the experience in data pump, lookups,
data file, not sure which I use here.

What I'm looking to do is to repeat something like, feeding the
servername, databasename and criteria into the select:

insert into MyDB.dbo.%2tbl select * from %1SMS_%2.dbo.table where
criteria like '%2_____'

Any advice appreciated.


Reply With Quote
  #2  
Old   
PaulaPompey
 
Posts: n/a

Default RE: please recommend best way to accomplish task on various sources - 06-23-2005 , 10:33 AM






You could build your select/insert statement from variables into one long
string variable then execute it.
eg.
SET @TSQL_STR = 'SELECT * FROM '
SET @TSQL_STR = @TSQL_STR + @SERVER + '.' + @DB + '.' + @OWNER + '.' + @TABLE
SET @TSQL_STR = @TSQL_STR + ' WHERE [Field] = 1'
exec(@TSQL_STR)

"jtrecords (AT) yahoo (DOT) com" wrote:

Quote:
Hi,
I'm trying to perform an INSERT that I can do currently using osql, but
I need to make some changes and thought that putting into a DTS would
be a good idea (instead of a scheduled task like the osql is now).

What I like about the osql is I connect to various servers using
variables, how would I accomplish this with DTS? I'm barely able to
script! I'm posting as I haven't the experience in data pump, lookups,
data file, not sure which I use here.

What I'm looking to do is to repeat something like, feeding the
servername, databasename and criteria into the select:

insert into MyDB.dbo.%2tbl select * from %1SMS_%2.dbo.table where
criteria like '%2_____'

Any advice appreciated.



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.