Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How to convert Varbinary(10) to a SSIS variable


How to convert Varbinary(10) to a SSIS variable

Author
Message
Ells
Ells
Right there with Babe
Right there with Babe (790 reputation)Right there with Babe (790 reputation)Right there with Babe (790 reputation)Right there with Babe (790 reputation)Right there with Babe (790 reputation)Right there with Babe (790 reputation)Right there with Babe (790 reputation)Right there with Babe (790 reputation)

Group: General Forum Members
Points: 790 Visits: 931
Peeps,
just ground to a halt on one package I am creating. I need to select a varbinary(10) value from an execute SQL task and store that value as a package variable.

So pop an Execute SQL Task down and store the result set as a package variable (string type).

When I execut the SQL in SSMS I get 0x000268CF000304510001

When I run SSIS in debug mode and watch the variable through the locals window I get 000268CF00

it seems to chop the front (0x) and the back(0304510001)?


Execute SQL task contains the Query
select sys.fn_cdc_get_max_lsn() as Banana

Then we use the result set to move Banana into the string package

Am I missing something here??
Thanks
M
Ells
Ells
Right there with Babe
Right there with Babe (790 reputation)Right there with Babe (790 reputation)Right there with Babe (790 reputation)Right there with Babe (790 reputation)Right there with Babe (790 reputation)Right there with Babe (790 reputation)Right there with Babe (790 reputation)Right there with Babe (790 reputation)

Group: General Forum Members
Points: 790 Visits: 931
After googling substantially before hand I stumbled across a blog linked to a codeplex sample. Trawling thorough that I got to

EXECUTE SQL TAsk contains:

declare
@startLSN binary(10),
@startLSN_str nvarchar(42)
select @startLSN = sys.fn_cdc_get_max_lsn()
select @startLSN_str = upper(sys.fn_varbintohexstr(@startLSN))
select @startLSN_str as PkgLSNEnd

This then returns data to a string that I can put in a package String variable.

They dont make this easy Smile
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search