Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Curly Braces around the Uniqueidentifier data type in MS SQL 2000

Posted on 2004-10-01
11
Medium Priority
?
1,788 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
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 

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 300 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
 
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 100 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
How much do you know about the future of data centers? If you're like 50% of organizations, then it's probably not enough. Read on to get up to speed on this emerging field.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

885 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