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
 General SQL Server Forums
 New to SQL Server Programming
 syntax error on isnull ?

Author  Topic 

gbeford
Starting Member

9 Posts

Posted - 2009-08-28 : 12:15:56
I am tring to create a query where if the stopDate is older then today or the value is null in the table it will give me just those results... however i seem to have a syntax error that I am just not seeing ? can someone help ? its only at the Or isnull line if i remove it the query will run



select TL_DSRV_KMA_PhoneList.ID,
SortOrder,
KMA_LongDesc,
KMA_ID,
DispatchLocation,
[Sys],
Prin,
[Site],
Co_Div,
Name,
Title,
OfficeNumber,
Extention,
CellNumber,
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday,
Sunday,
StartHour,
EndHour,
Notes,
TL_DSRV_KMA_PhoneList.StartDate,
TL_DSRV_KMA_PhoneList.StopDate

from TL_DSRV_KMA_PhoneList
join TL_KMA_Reference
on KMA_ID = TL_KMA_Reference.ID

where TL_DSRV_KMA_PhoneList.StopDate >= getdate()
OR isnull TL_DSRV_KMA_PhoneList.StopDate

Thanks
Gina

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2009-08-28 : 13:00:33
OR TL_DSRV_KMA_PhoneList.StopDate IS NULL

Jim
Go to Top of Page

gbeford
Starting Member

9 Posts

Posted - 2009-08-28 : 13:14:53
Thank you so much... :) i have been pulling my hair out with this one
Go to Top of Page

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2009-08-28 : 13:20:55
You're welcome. ISNULL is actually it's own function
ISNULL(Column,'a') returns an 'a' if Column is null

Jim
Go to Top of Page
   

- Advertisement -