Solved

Uniqueidentifier

Posted on 2001-07-18
4
320 Views
Last Modified: 2012-08-14
When I return a recordset from the database and it has a uniqueidentifier. It returns the guid with the squirly brackets around the guid eg.
{4559EBAB-D407-4F37-BF15-8103FFB8B635}.

If I take this guid and do and insert with this guid into another table on my database. Everything works fine.

Now we have a staging server. We backed up and restored my database to this server. Put all the same dll's on this machine.

But when I try do an insert using this guid with the brackets around it, I get the following error: "Error converting a varchar to a uniqueidentifier". If I change my connection string to point to the staging servers database, I don't get the same error.

The staging server and my machine are both running the same dll's and have the same version of SQL.
Does anyone have any idea, why I would be getting this problem.
0
Comment
Question by:JohnRock
  • 3
4 Comments
 
LVL 7

Accepted Solution

by:
lozzamoore earned 100 total points
ID: 6293016
What client tool are you using to do the inserts?
Also, what version of SQL Server for both servers?

Normally, query analyser returns the guids without curly brackets and they can be inserted as standard text fields
(SQL 7 and 2000)
I don't think uniqueidentifier is a supported data type in SQL 6.5 so you can't be using that(?)

eg.
insert guidtest values ('DA561AE4-7090-11D5-9DDD-00D0B73E502C', ...)

Cheers.
0
 

Author Comment

by:JohnRock
ID: 6293056
You see that's the problem when I return the guid, the guid is wrapped with curly brackets. Then when I do an insert using this value, I get the conversion error from varchar to uniqueidentifier.

We are using SQL 2000.

Storing the value as text, would probably solve the problem, but I am interested, as to why this would work on my version with the same database, and not on the staging server database.
0
 

Author Comment

by:JohnRock
ID: 6293071
About the client tool, I'm using ado, to do the insert.
0
 

Author Comment

by:JohnRock
ID: 6293597
Sorry for wasting you're time, I found the problem, it actually has something to do with special characters in the attribute tags of my xml string that I was returning using the persist method from the ado recordset.

But thanks for you're help.

0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to shrink a transaction log file down to a reasonable size.

744 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

12 Experts available now in Live!

Get 1:1 Help Now