dbTalk Databases Forums  

Cannot use global variable in executeSQL task ?

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


Discuss Cannot use global variable in executeSQL task ? in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Bluesky25
 
Posts: n/a

Default Cannot use global variable in executeSQL task ? - 09-10-2004 , 03:55 AM






Hello,

I do not know much about DTS global variables and I cannot use global
variables references ("?") in some DTS exec sql tasks :
For example :

DECLARE @var INT
SET @var = ?

[...] (quite long script)

does not work: I guess "SET ... = ?" is not allowed but what is the
workaround ?
When I click on "Parameters" or "Analyse", I get "Syntax error or
Access violation"... but when I replace ? by a value, the task works
well.
I really do not know how to solve this problem...

I would be great if someone could give me some information or some web
links in order to learn more about global variables use.

Thank you,

--
Bluesky25.


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

Default Re: Cannot use global variable in executeSQL task ? - 09-10-2004 , 04:12 AM






In message <mn.528f7d49af5b1865.17504 (AT) despamonline (DOT) fr>, Bluesky25
<bluesky25_pas (AT) de_spam_online (DOT) fr> writes
Quote:
Hello,

I do not know much about DTS global variables and I cannot use global
variables references ("?") in some DTS exec sql tasks :
For example :

DECLARE @var INT
SET @var = ?

[...] (quite long script)

does not work: I guess "SET ... = ?" is not allowed but what is the
workaround ?
When I click on "Parameters" or "Analyse", I get "Syntax error or
Access violation"... but when I replace ? by a value, the task works
well.
I really do not know how to solve this problem...

I would be great if someone could give me some information or some web
links in order to learn more about global variables use.

Thank you,

There is a workaround described here, where you use a simple statement
to set the parameters then swap it out for your real SQL behind the
scenes-

Global Variables and Stored Procedure Parameters
(http://www.sqldts.com/default.aspx?234)

--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org



Reply With Quote
  #3  
Old   
Bluesky25
 
Posts: n/a

Default Re: Cannot use global variable in executeSQL task ? - 09-13-2004 , 04:49 AM



Darren Green avait écrit le 10/09/2004 :
Quote:
In message <mn.528f7d49af5b1865.17504 (AT) despamonline (DOT) fr>, Bluesky25
bluesky25_pas (AT) de_spam_online (DOT) fr> writes
Hello,

I do not know much about DTS global variables and I cannot use global
variables references ("?") in some DTS exec sql tasks :
For example :

DECLARE @var INT
SET @var = ?

[...] (quite long script)

does not work: I guess "SET ... = ?" is not allowed but what is the
workaround ?
When I click on "Parameters" or "Analyse", I get "Syntax error or Access
violation"... but when I replace ? by a value, the task works well.
I really do not know how to solve this problem...

I would be great if someone could give me some information or some web links
in order to learn more about global variables use.

Thank you,


There is a workaround described here, where you use a simple statement to set
the parameters then swap it out for your real SQL behind the scenes-

Global Variables and Stored Procedure Parameters
(http://www.sqldts.com/default.aspx?234)
It works well but I cannot check my SQL scripts syntax anymore...
(Error caused by the "SET..." written "offline")

Thanks a lot anyway !

--
Bluesky25.



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.