SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How to read UniqueIdentifier output parameter from a stored procedure via OLE DB


How to read UniqueIdentifier output parameter from a stored procedure via OLE DB

Author
Message
TimWhitemore
TimWhitemore
Valued Member
Valued Member (64 reputation)Valued Member (64 reputation)Valued Member (64 reputation)Valued Member (64 reputation)Valued Member (64 reputation)Valued Member (64 reputation)Valued Member (64 reputation)Valued Member (64 reputation)

Group: General Forum Members
Points: 64 Visits: 125
I have a stored procedure that takes some input parameters and returns a GUID as an output parameter. I want to call this SP using an OLE DB Source but the lack of any UniqueIdentifier data type within SSIS results in a data type conversion error.

"Error converting data type varchar to uniqueidentifier"

The SQL Command syntax is as follows:

EXEC ? = Control.dbo.PROC_FILESYS_Dir_Tree @FilePath = ?, @ObjectTypeFlag = 'File', @DirID = ? OUTPUT

The 1st 2 parameters (return code and file path) can be set no problem but when I try to map the 3rd (output) parameter to a string variable it throws the error. I realise this is a known problem but all of the online help seems to focus on GUIDs as input parameters and suggests adding {brackets} around the GUID value but for me this is an OUTPUT parameter so this advice does not help.

All suggestions appreciated.
michal.lisinski
michal.lisinski
SSCommitted
SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)

Group: General Forum Members
Points: 1904 Visits: 1105
Hi Tim

Imho you could convert it to char directly in SP.

Br.
Mike
TimWhitemore
TimWhitemore
Valued Member
Valued Member (64 reputation)Valued Member (64 reputation)Valued Member (64 reputation)Valued Member (64 reputation)Valued Member (64 reputation)Valued Member (64 reputation)Valued Member (64 reputation)Valued Member (64 reputation)

Group: General Forum Members
Points: 64 Visits: 125
Thanks for the suggestion Michal. Casting to string would of course be simple but the SP is widely used elsewhere and I don't want to be changing an output data type because that may break other interfaces.

On the face of it it seems that Microsoft don't support GUIDs across their technology stack which just beggars belief. As a developer I want to spend my time solving business problems but with Microsoft I seem to spend most of my time trying to code my way around gotchas in their implementation.
michal.lisinski
michal.lisinski
SSCommitted
SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)SSCommitted (1.9K reputation)

Group: General Forum Members
Points: 1904 Visits: 1105
Hi Tim

I know that my previous advice was very trivial but the simplest solution is the best when you have a deadline to do sth.

Please take a look for that link: http://microsoft-ssis.blogspot.com/2011/02/create-guid-column-in-ssis.html
Imho it could help.

Br.
Mike
TimWhitemore
TimWhitemore
Valued Member
Valued Member (64 reputation)Valued Member (64 reputation)Valued Member (64 reputation)Valued Member (64 reputation)Valued Member (64 reputation)Valued Member (64 reputation)Valued Member (64 reputation)Valued Member (64 reputation)

Group: General Forum Members
Points: 64 Visits: 125
Thanks again. I don't feel that this approach really addresses my circumstances in a satisfactory way so I'll review my options.

Perhaps I'll develop SSIS wrapper SPs just to get around the problem. More likely I'll simply not use SSIS at all as I have an extensive T-SQL code library that can achieve what I want quickly.
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