Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Uniqueidentifier

Posted on 2001-07-18
4
Medium Priority
?
331 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 7

Accepted Solution

by:
lozzamoore earned 300 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

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

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

I have a large data set and a SSIS package. How can I load this file in multi threading?
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

715 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