Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 converting a character string to uniqueidentifier.

Author  Topic 

venkatsrv
Starting Member

2 Posts

Posted - 2008-04-06 : 10:39:54
Dear Team,

Getting error while trying to insert the value in the table..
this 2 values are generated from asp.net '97069439-de6e-467c-8357-14b6db045a3e', '169d62a1-3fa3-4bd2-a1bc-05f3d5787012' through GUID.

Can anyone throw some light...just struck with this..

declare @a uniqueidentifier, @b uniqueidentifier
set @a = '97069439-de6e-467c-8357-14b6db045a3e'
set @b = '169d62a1-3fa3-4bd2-a1bc-05f3d5787012'

select * from a where col1_id = @b
0 rows found
select * from a where col2_id = @a
0 rows found
Insert into a(col1_id, col2_id, col3_DateCreated)
values (@a , @b , getdate())

Server: Msg 8169, Level 16, State 2, Line 5
Syntax error converting from a character string to uniqueidentifier.

Thanks..
Venkat

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-06 : 13:07:35
refer this. might help you out:-

http://jesschadwick.blogspot.com/2007/11/safe-handling-of-uniqueidentifier-in.html
Go to Top of Page
   

- Advertisement -