Solved

Uniqueidentifier

Posted on 2001-07-18
4
321 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

861 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

24 Experts available now in Live!

Get 1:1 Help Now