Hi,
i have a field createdby with datatype GUID.
In following query ,i encountered with the error
"Conversion failed when converting from a character string to uniqueidentifier"
select
ISNULL(VW_tbl_ChildProducts.createdBy,' ' ) as createdBy
from table.
it is running with sql server 2005, but not supporting by sql 2000.
what is the synax in 2000?
An empty may be placed as placeholder for ISNULL.
As in
- declare @x as varchar(5)
-
-
select isnull(@x,' ')
When using ISNULL, you have to make sure that the value that will be used in replacement of the field being checked may be used to replace the field being checked. So if the field is datetime, the replacement value should also be datetime or at least may be converted into datetime.
It looks like you're checking a column that is a uniqueidentifier data type but you're replacing it with a string/varchar.
Read more about uniqueidentier
here
-- CK