dbTalk Databases Forums  

Max length of string global variable

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


Discuss Max length of string global variable in the microsoft.public.sqlserver.dts forum.



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

Default Max length of string global variable - 07-14-2005 , 02:40 PM






Is there a max length for DTS Global Variables of type string? I have a
stored procedure that I am running using an Execute SQL Task and it is
outputting a paramater of type varchar. I would like to output that
parameter to the DTS package. The output parameter is at least 500
characters and the global variable is showing up as not displayable.

Any help is appreciated.

Thanks

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

Default Re: Max length of string global variable - 07-14-2005 , 02:48 PM






Should be OK

I did this

IN an ExecuteSQL task did

SELECT REPLICATE('A',1000) as Value

I assigned this to an output variable of type string

I then had an ActiveScript task that did

MsgBox(Len(DTSGlobalVariables("Val").Value))


The answer was 1000

It looks as though your value is not being set. Period.

Does it work with a smaller size varchar?

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


"Andy" <Andy (AT) discussions (DOT) microsoft.com> wrote

Quote:
Is there a max length for DTS Global Variables of type string? I have a
stored procedure that I am running using an Execute SQL Task and it is
outputting a paramater of type varchar. I would like to output that
parameter to the DTS package. The output parameter is at least 500
characters and the global variable is showing up as not displayable.

Any help is appreciated.

Thanks



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

Default Re: Max length of string global variable - 07-14-2005 , 03:02 PM



Yes it does work with a smaller size varchar, however I am getting mixed
results. Sometimes with a larger varchar it has worked.
"Allan Mitchell" wrote:

Quote:
Should be OK

I did this

IN an ExecuteSQL task did

SELECT REPLICATE('A',1000) as Value

I assigned this to an output variable of type string

I then had an ActiveScript task that did

MsgBox(Len(DTSGlobalVariables("Val").Value))


The answer was 1000

It looks as though your value is not being set. Period.

Does it work with a smaller size varchar?

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


"Andy" <Andy (AT) discussions (DOT) microsoft.com> wrote in message
news:BABF4C3A-1E64-4D8D-89E1-7618288E46EA (AT) microsoft (DOT) com...
Is there a max length for DTS Global Variables of type string? I have a
stored procedure that I am running using an Execute SQL Task and it is
outputting a paramater of type varchar. I would like to output that
parameter to the DTS package. The output parameter is at least 500
characters and the global variable is showing up as not displayable.

Any help is appreciated.

Thanks




Reply With Quote
  #4  
Old   
mehdi
 
Posts: n/a

Default Re: Max length of string global variable - 09-20-2005 , 05:23 AM



I had the same problem. I solved it this way

Well, when I launch dtsrun with a string parameter, it only passes the 255
first caracter to the global variable. So the solution is in the SQL code,
declare as many 255 variables and concatenate them in the DTS Code:

in sql code:

declare varlongstring nvarchar(4000),
varsubstring1 varchar(255),
varsubstring2 varchar(255),
.....

SET varsubtsring1 = substring(varlongstring , 1,255)
SET varsubtsring2 = substring(varlongstring , 256,510),
...

then send dtsrun /Avar1:8=varsubtsring1 /Avar2:8=varsubtsring2, .....

IN the DTS package
declare the global string variables varlongstring, var1, var2,...

and in a activeX, concatenation

DTSGlobalVariables("Varlongstring").Value =
DTSGlobalVariables("var1").Value & DTSGlobalVariables("var2").Value
DTSGlobalVariables("Varlongstring").Value =
DTSGlobalVariables("Varlongstring").Value & DTSGlobalVariables("var3").Value


Hope it's fine you

Mehdi






--
mehdi


"Andy" wrote:

Quote:
Yes it does work with a smaller size varchar, however I am getting mixed
results. Sometimes with a larger varchar it has worked.
"Allan Mitchell" wrote:

Should be OK

I did this

IN an ExecuteSQL task did

SELECT REPLICATE('A',1000) as Value

I assigned this to an output variable of type string

I then had an ActiveScript task that did

MsgBox(Len(DTSGlobalVariables("Val").Value))


The answer was 1000

It looks as though your value is not being set. Period.

Does it work with a smaller size varchar?

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


"Andy" <Andy (AT) discussions (DOT) microsoft.com> wrote in message
news:BABF4C3A-1E64-4D8D-89E1-7618288E46EA (AT) microsoft (DOT) com...
Is there a max length for DTS Global Variables of type string? I have a
stored procedure that I am running using an Execute SQL Task and it is
outputting a paramater of type varchar. I would like to output that
parameter to the DTS package. The output parameter is at least 500
characters and the global variable is showing up as not displayable.

Any help is appreciated.

Thanks




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.