Tuesday, March 20, 2012
3 global variables 3 sql server connections?
I've 3 sql server connections in the DTS package. They are:
conn1
conn2
conn3
Using dynamic properties task, I set up three global variables (gv1, gv2
and gv3).
For conn1 - I am getting server value from @.@.servername. (I am running
this pkg under a sql server job). see the pkg execution code:
declare @.dtsrun varchar(300)
set @.dtsrun = 'dtsrun /F d:\DTS\Mydts.dts /N Mydts /Agv1:8=' +
@.@.servername
exec master.dbo.xp_cmdshell @.dtsrun
for conn2 and conn3, I am using ActiveX script inside the DTS pkg to get
the server values (which are stored in a table in the db).
I am getting server values for 'gv2' and 'gv3'. My question is how would
I pass "gv2" value in "conn2" and "gv3" value in "conn3"?
thanks for your help!
*** Sent via Developersdex http://www.examnotes.net ***why don't have such values into global variables? It seems the most reliable
and safe way
--
Current location: Alicante (ES)
"Test Test" wrote:
> Hello!
> I've 3 sql server connections in the DTS package. They are:
> conn1
> conn2
> conn3
> Using dynamic properties task, I set up three global variables (gv1, gv2
> and gv3).
> For conn1 - I am getting server value from @.@.servername. (I am running
> this pkg under a sql server job). see the pkg execution code:
> declare @.dtsrun varchar(300)
> set @.dtsrun = 'dtsrun /F d:\DTS\Mydts.dts /N Mydts /Agv1:8=' +
> @.@.servername
> exec master.dbo.xp_cmdshell @.dtsrun
> for conn2 and conn3, I am using ActiveX script inside the DTS pkg to get
> the server values (which are stored in a table in the db).
> I am getting server values for 'gv2' and 'gv3'. My question is how would
> I pass "gv2" value in "conn2" and "gv3" value in "conn3"?
> thanks for your help!
>
>
>
>
>
> *** Sent via Developersdex http://www.examnotes.net ***
>
Saturday, February 25, 2012
2005 Stored Procedure Question - How to pass in additional LIKEconditions
I believe the problem is because you're mixing up dynamic SQL with
static SQL.
The @.SearchTerm variable that you are building up can not be used to
specify additional LIKE criteria for the Subject column, each LIKE
condition needs to be individually coded into your static SQL.
The alternative is to build the entire SELECT as dynamic SQL. This
provides additional flexibility, but there are performance and
security implications when doing this (google SQL injection).
Good luck!
JOn Dec 17, 10:33 am, jhofm...@.googlemail.com wrote:
Quote:
Originally Posted by
Hi Paparush,
>
I believe the problem is because you're mixing up dynamic SQL with
static SQL.
The @.SearchTerm variable that you are building up can not be used to
specify additional LIKE criteria for the Subject column, each LIKE
condition needs to be individually coded into your static SQL.
>
The alternative is to build the entire SELECT as dynamic SQL. This
provides additional flexibility, but there are performance and
security implications when doing this (google SQL injection).
>
Good luck!
J
Hi J,
Thanks for the reply.
Yes..the dynamic SQL is the approach I've been trying all morning and
I've gotten it to work. I have to build the entire SELECT string in
my app's code, based on the search term the user enters and then stuff
this into @.SearchTerm and pass this string into the code below.
declare @.SearchTerm nvarchar(max)
EXEC sp_ExecuteSQL @.Search