Solved

Curly Braces around the Uniqueidentifier data type in MS SQL 2000

Posted on 2004-10-01
11
1,407 Views
Last Modified: 2008-01-16
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.
0
Comment
Question by:wyogirl77
  • 4
  • 4
  • 3
11 Comments
 
LVL 4

Expert Comment

by:willcode4coffee
ID: 12201816
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@
0
 

Author Comment

by:wyogirl77
ID: 12201972
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
0
 
LVL 5

Expert Comment

by:kemp_a
ID: 12202136
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?

0
 

Author Comment

by:wyogirl77
ID: 12202203
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
0
 
LVL 4

Assisted Solution

by:willcode4coffee
willcode4coffee earned 75 total points
ID: 12202359
You should be able to format the output of it in your SQLselect using some basic substring commands, leaving out the braces.

On a side note, is there a reason you can't have the braces included? I have used them in URLs and they work fine.

M@
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 4

Expert Comment

by:willcode4coffee
ID: 12202389
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@
0
 
LVL 5

Accepted Solution

by:
kemp_a earned 25 total points
ID: 12202691
Thank you willcode4cofee, lets distress wyogirl77 some more arguing about the structal format of GUID!

I dont believe that I proposed that a GUID was a "text value", neither did I propose it was a number. The structure of a GUID is essentially a multi-part number that has the following characteristics:

GUID
Globally Unique Identifier. cf UID. Identifier generated according to an algorithm that is intended to be unique across all systems.

As opossed the theory of a hexidecimal numerical system, which would contradict willcode4cofee's theroy that a "number cannot have letters and characters, just numbers" hence we should base our entire thoretical computation on the castugation that A, B, C, D, E & F have no numerical significancewhat so ever!

Back to my original answer to wyogirl77's original question, are there any other fields that you can match your data too?  I cannot see why you would have difficulty using the GUID as long as the format/cast/conversion meets whatever criteria is needed.

Cheers
0
 
LVL 4

Expert Comment

by:willcode4coffee
ID: 12202745
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@
0
 
LVL 5

Expert Comment

by:kemp_a
ID: 12203188
Hi wyogirl77
So you return value is being passed to an ASP page or some other web service function, am I correct?

0
 
LVL 5

Expert Comment

by:kemp_a
ID: 12203258
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
0
 

Author Comment

by:wyogirl77
ID: 12203406
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.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Read about achieving the basic levels of HRIS security in the workplace.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now