dbTalk Databases Forums  

Dynamic Properties task and sql execute task

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


Discuss Dynamic Properties task and sql execute task in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Hans - DiaGraphIT -
 
Posts: n/a

Default Dynamic Properties task and sql execute task - 11-29-2005 , 03:23 AM






Hi!

this is my case. I have an ini-file containing info about server location,
password and database name. My "dynamic properties task" reads from the
ini-file and the specified values. My next step is a SQL Execute task where
I want to create a database based on the name from the ini-file. How do I
get this value in to my SQL statement?

Any help or Idea?

Best regards
--------------------
Hans

Reply With Quote
  #2  
Old   
Darren Green
 
Posts: n/a

Default Re: Dynamic Properties task and sql execute task - 11-29-2005 , 11:07 AM






Exec SQL Tasks support parameters, but this is OLE-DB parameter support,
which is similar to that in T-SQL, so as rule of thumb if you cannot use a
local variable in T-SQL then you can't in the task either. A database name
for a CREATE DB statement cannot be a parameter. In T-SQL you would use
dynamic SQL, but parameters don't work with this very well in the task. The
way to do this is use an ActiveX Script Task to prepare the SQL Statement in
advance and then set it.

Use the Dynamic Properties task to read the new DB name into global
variable.
Use an ActiveX Script Task to build the CREATE DB command, and set the
SQLStatement property of the Exec SQL Task.


Global Variables and SQL statements in DTS
(http://www.sqldts.com/default.aspx?205)


--
Darren Green
http://www.sqldts.com
http://www.sqlis.com


"Hans - DiaGraphIT -" <HansDiaGraphIT (AT) discussions (DOT) microsoft.com> wrote in
message news:6BD583F2-6E68-4711-BF34-667ADE76CAFA (AT) microsoft (DOT) com...
Quote:
Hi!

this is my case. I have an ini-file containing info about server
location,
password and database name. My "dynamic properties task" reads from the
ini-file and the specified values. My next step is a SQL Execute task
where
I want to create a database based on the name from the ini-file. How do I
get this value in to my SQL statement?

Any help or Idea?

Best regards
--------------------
Hans



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.