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.
| Author |
Topic |
|
Newkid
Starting Member
7 Posts |
Posted - 2008-12-08 : 13:27:43
|
| Hi there!Can expert helps me to understand the below error?Msg 8169, Level 16, State 2, Line 1Conversion failed when converting from a character string to uniqueidentifier.I am getting this error when firing the below query:SELECT default_currency FROM Company WHERE Company.pkid = '{0}'Please advice, I am getting this error. How to get rid of it? If a table doesn't have a record, it should display zero record retrieve.Edited: If I provide a GUID value in the select query, it's working but when I try to retrieve it thru control it's NOT. Any idea?Correct me if I am wrong!Would appreciate your prompt response!With Thanks !Newkid |
|
|
hanbingl
Aged Yak Warrior
652 Posts |
Posted - 2008-12-08 : 13:54:21
|
| uniqueidentifier data type can only be initialized to a value by using NEWID() function or by converting from a string constant in the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, in which each x is a hexadecimal digit in the range 0-9 or a-f. For example, 00000000-0000-0000-0000-000000000000 is a valid uniqueidentifier value... |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-09 : 02:42:21
|
quote: Originally posted by hanbingl uniqueidentifier data type can only be initialized to a value by using NEWID() function or by converting from a string constant in the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, in which each x is a hexadecimal digit in the range 0-9 or a-f. For example, 00000000-0000-0000-0000-000000000000 is a valid uniqueidentifier value...
Also NEWSEQUENTIALID() can be used for initialization of uniqueidentifiers |
 |
|
|
|
|
|