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

  • 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.

  • Hi Tim

    Imho you could convert it to char directly in SP.

    Br.

    Mike

  • 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.

  • 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

  • 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.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply