Unix Technical Forum

retrive all records within the Case statment

This is a discussion on retrive all records within the Case statment within the MS SQL ODBC forums, part of the Microsoft SQL Server category; --> i want to filter a table by a view using a defind function for example: select * from person ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > MS SQL ODBC

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2008, 08:45 PM
Sam
 
Posts: n/a
Default retrive all records within the Case statment

i want to filter a table by a view using a defind function
for example:
select * from person
where dbo.person.company like case CmpName()
when 'all' then '%'
else CmpName()
end

prblem is that '%' doesn't show the records with NULL value
how can i
thanks
sam


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-27-2008, 08:45 PM
Uwa Agbonile [MSFT]
 
Posts: n/a
Default Re: retrive all records within the Case statment

Try using IS NULL clause

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Regards,
Uwa Agbonile[MSFT]

"Sam" <focus10@zahav.net.il> wrote in message
news:uWyStcqYFHA.3364@TK2MSFTNGP12.phx.gbl...
> i want to filter a table by a view using a defind function
> for example:
> select * from person
> where dbo.person.company like case CmpName()
> when 'all' then '%'
> else CmpName()
> end
>
> prblem is that '%' doesn't show the records with NULL value
> how can i
> thanks
> sam
>
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-27-2008, 08:45 PM
Sam
 
Posts: n/a
Default Re: retrive all records within the Case statment

"IS NULL" is not working with "=" , or "Like" operators
so i can not use it with the "CASE" statment


"Uwa Agbonile [MSFT]" <uwaag@online.microsoft.com> wrote in message
news:ez3NxhwYFHA.2572@TK2MSFTNGP14.phx.gbl...
> Try using IS NULL clause
>
> --
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> Regards,
> Uwa Agbonile[MSFT]
>
> "Sam" <focus10@zahav.net.il> wrote in message
> news:uWyStcqYFHA.3364@TK2MSFTNGP12.phx.gbl...
>> i want to filter a table by a view using a defind function
>> for example:
>> select * from person
>> where dbo.person.company like case CmpName()
>> when 'all' then '%'
>> else CmpName()
>> end
>>
>> prblem is that '%' doesn't show the records with NULL value
>> how can i
>> thanks
>> sam
>>
>>

>
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:16 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com