Author |
Topic  |
|
susan_151615
Yak Posting Veteran
India
99 Posts |
Posted - 06/15/2009 : 00:30:12
|
Hi I have a column which is of GUID type and of nullable type. I need to do null check for this column of guid type. Is this the proper way to do null check for GUID data type:
IsNUll(employee.empid,NULL)here empid is a GUID value
susan |
|
webfred
Flowing Fount of Yak Knowledge
Germany
8781 Posts |
Posted - 06/15/2009 : 01:17:40
|
No that is not to check if empid is null it is to replace the value of empid in case of null. select isnull(empid,666) would return 666 if empid is null for example.
The check would be IF empid IS NULL or WHERE empid IS NULL
Greetings Webfred
No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
khtan
In (Som, Ni, Yak)
Singapore
17689 Posts |
Posted - 06/15/2009 : 01:18:46
|
where employee.empid is null
KH Time is always against us
|
 |
|
susan_151615
Yak Posting Veteran
India
99 Posts |
Posted - 06/15/2009 : 01:40:33
|
Suppose i want to return it blank value then how to replace it in null check because it will not accept the replacement with '' as it is not varchar it throws error during execution
susan |
 |
|
webfred
Flowing Fount of Yak Knowledge
Germany
8781 Posts |
Posted - 06/15/2009 : 01:53:09
|
Can you show us an example in context what you're trying to do please?
No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
susan_151615
Yak Posting Veteran
India
99 Posts |
Posted - 06/15/2009 : 01:58:11
|
this is what am trying to do
select ISNULL(EMPLOYEE.EMPNAME,'') AS EMPLOYEE NAME, EMPLOYEE.EMPID AS EMPLOYEEID INTO #EMP
here empname is varchar and empid is guid type and how to do null check for this guid type
susan |
 |
|
khtan
In (Som, Ni, Yak)
Singapore
17689 Posts |
Posted - 06/15/2009 : 02:00:03
|
isnull(convert(varchar(36), empid ), '')
KH Time is always against us
|
 |
|
susan_151615
Yak Posting Veteran
India
99 Posts |
Posted - 06/15/2009 : 02:09:26
|
No guid cant be converted into varchar type it will be not compatible in front end processotr even though it can be executed in sql
susan |
 |
|
khtan
In (Som, Ni, Yak)
Singapore
17689 Posts |
Posted - 06/15/2009 : 02:11:14
|
quote: Originally posted by susan_151615
No guid cant be converted into varchar type it will be not compatible in front end processotr even though it can be executed in sql
susan
then handle the NULL value in your front end not in the query
KH Time is always against us
|
Edited by - khtan on 06/15/2009 02:11:33 |
 |
|
Lamprey
Flowing Fount of Yak Knowledge
4614 Posts |
Posted - 06/15/2009 : 11:46:52
|
Maybe you want to do something like:COALESCE(empid, CAST('00000000-0000-0000-0000-000000000000' AS UNIQUEIDENTIFIER)) |
 |
|
|
Topic  |
|