dbTalk Databases Forums  

Re: Variable Probelm

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


Discuss Re: Variable Probelm in the microsoft.public.sqlserver.dts forum.



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

Default Re: Variable Probelm - 07-09-2004 , 02:21 PM






You can use the parameters button if you are using SQL Server 2000 to
supply values to the ? Placeholders by matching them to Global
Variables.

So in your example you will have 1 * Output variable and 1 * Input
variable

In SQL Server 7 you will need to use something like this

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


Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


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

Default Re: Variable Probelm - 07-09-2004 , 04:04 PM






Thanks for your reply. Still I am not sure how to use this O/P variable in SQL statement.

I have SQL 2K.

My confusion is :

This is my task in DTS
Both this variable decalre in dts pckg/global variable option..

Rundate as Date
RudateforSQL date (Rundate<> RudateforSQL do not have same value)

select
x1,x2 , ?(RundateforSQL) from XYZ where x1= ? (Rundate )

Can I assume that if I exceute this SQL Statement task then it will retun
variable value (RundateforSQL) in result set. Actually when I try this I am getting some memory error and DTS pckg gets closed..

Thanks once again!





"Allan Mitchell" wrote:

Quote:
You can use the parameters button if you are using SQL Server 2000 to
supply values to the ? Placeholders by matching them to Global
Variables.

So in your example you will have 1 * Output variable and 1 * Input
variable

In SQL Server 7 you will need to use something like this

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


Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org



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

Default Re: Variable Probelm - 07-10-2004 , 01:21 AM



If you are getting a memory error then this suggests something may be
wrong with your SQL Server.

I think you have the methodology slightly wonky.

The RunDateForSQL should be assigned as an output variable by you
picking up a field in your statement i.e.

Imagine I have this statement

select au_id, au_lname from authors where au_fname = ?

I would have

1 * Input global Variable (?)
2 * output (Row Value) global variables

So in your example you should be choosing an attribute in the source
table and assigning it to the global variable RunDateForSQL

Does that help



Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


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.