Link to home
Start Free TrialLog in
Avatar of wyogirl77
wyogirl77

asked on

Curly Braces around the Uniqueidentifier data type in MS SQL 2000

Just have a quick question, I am using the unique identifier data type in MS SQL 2000, and the curly braces around the unique identifier show up when I view the table and when I create a view using the same table, was just curious why they don't show up in query analyzer when I runa query on the table and is there a way to remove the curly braces from the unique identifier field?
Thank you in advance.
Avatar of willcode4coffee
willcode4coffee

This is just how SQL displays them. Uniqueidentifier is technically a GUID (Globally Unique Identifier) that consists of a 128-bit number. This is an extremely large number and would be even more cumbersome to display that the format you are referring to. So it is displayed in a formatted hexidecimal mask. The curly braces are just an indicator that it is a GUID and are not part of the actual identifier.

M@
Avatar of wyogirl77

ASKER

Ok, but I am trying to merge information from the database into a program I am using and the curly braces show up everytime and I need them to not show up is there a way to not make them show up in the table, since the information is coming straight from the table and being merged into the message I am sending out, it is including the curly braces and I need them to not be included, sorry if this is confusing.
thank you
Hey wyogirl77,
This is not how SQL displays them, it is how Windows makes them. A guid or 'Globally Uniqe IDentifier' is virtually uniuqe to You give or take another 64 thousand other variables!

My question is, Do you have any additonal fields in your table that identify the recipient of your message?
The reasons for asking this is because a GUID is created on a 1 time basis, unique to that space & time, excluding other fields in your table.

What do you expect to recieve back, from the mesages you send out, that would make the GUID un-usable!

Can yo compound some other fields to recognise the response?

Well, I am actually helping someone with this so will give you the background, he wants to create unique url's in the message he is sending out, so we are merging the UID field into the message we are sending out, it looks like this, UID={UID} and then when it merges, the link ends up looking like this UID={XXXX-XXXX-.......} and we need it to not include the curly braces, do you know if there is a way to fix this and is it part of Windows or SQL Server?
Thank you
SOLUTION
Avatar of willcode4coffee
willcode4coffee

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I beg to differ with kemp_a on the statement that "This is not how SQL displays them, it is how Windows makes them."

This is an inaccurate statement. A GUID is not a text value at all in the database...it is a number. A number. A number cannot have letters and characters, just numbers. It is the same concept as a date in SQL Server. You can display it however you want, but in the database, it is a number.

Therfore, it is stored as a number and displayed as a string. Oracle does not display them with the braces and dashes, but they are the exact same number.

M@
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hexidecimal is a way to represent numbers. A format. I give up and bow out of this discussion since you are right and it has nothing to do with the question at hand. However, I don't think using some other fields as identifiers is the answer. That is what a Uniqueidentifier is for. I think the real question is: Can you reformat it to a form you need for the URL? Or is it even neccessary since a GUID is passed in a URL trouble-free.

I have recently written a couple of VB.Net functions that strip the curly braces and dashes out of a string representation of a guid and another that replaces them. I can post them if you would like. Using the logic, you could strip the curly braces when you create the URL, then add them back when doing your database query.

M@
Hi wyogirl77
So you return value is being passed to an ASP page or some other web service function, am I correct?

willcode4coffee's assistance would be greatly appreciated by wyogirl77 I'm sure, the requirements and aspects of modern systems development are greatly enhanced with diverse points of view
I don't think it is an ASP page, we want to use it to track opened emails, let me find out more about the process we are using and thank you both for the insight.