February 28, 2016 at 4:14 pm
Greetings -
I have a package which extracts data from SQL into an EXCEL datasheet, one of the columns is a GUID. I use a data conversion task to convert the GUID from the source to a Unicode string and have configured the error output to ignore in case of failure before it is extracted to the spreadsheet. I get brackets around the GUIDs when they re copied to the destination.
How I go about exporting GUID from SQL to Excel without getting the brackets?
Same thing happens if I try to extract the GUID from SQL to .txt file, I end up with the Guid starting and ending with brackets (ex: {11111-1111})
Thanks,
Lava
February 29, 2016 at 6:59 am
The curly braces are added by SSIS when you are converting from a Uniquidentifier to a string.
There's two ways to get around it really. Either convert your guid in your SQL command, like so:
CONVERT(NVARCHAR(36), [Myguid])
Or if you need to do it in SSIS you can perform a string manipulation (after you have converted to a WTSR) in a derived column transform.
Something like
SUBSTRING(TxtGuid, 2, LEN(TxtGuid) - 2)
would do the trick.
Either of these will then export to Excel without the braces.
February 29, 2016 at 7:05 am
Great, I am testing it now. I will update you shortly.
March 1, 2016 at 10:57 am
It worked perfectly, I had to deal with some fixed width of columns afterwards and that was fixed too. Thank you. I fixed it at the source level by converting to varchar in the SQL statement.
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy