August 18, 2010 at 5:52 am
IF Exists (
select 1 where month(getdate()) IN (1,3,5,7,8,10,12)
)
i am not getting the solution for the error which this code is generting, can any one help me.
Shiv
August 18, 2010 at 6:26 am
You don't have a "source" defined to apply the WHERE clause to. Your source is a table with one row and one column holding the month of getdate():
IF Exists (
SELECT 1 FROM (SELECT month(getdate()) AS col) tbl WHERE col IN (1,3,5,7,8,10,12)
)
PRINT 'yes'
ELSE
PRINT 'no'
But wouldn't it be easier to evaluate the function in the first place?
IF month(getdate()) IN (1,3,5,7,8,10,12)
PRINT 'yes'
ELSE
PRINT 'no'
August 18, 2010 at 7:00 am
LutzM (8/18/2010)
You don't have a "source" defined to apply the WHERE clause to.
Does not have to, this is valid
IF EXISTS (SELECT 1 WHERE MONTH(GETDATE()) IN (1,3,5,7,8,10,12))
PRINT 'yes'
ELSE
PRINT 'no'
Far away is close at hand in the images of elsewhere.
Anon.
August 18, 2010 at 7:11 am
tkshiv20 42687 (8/18/2010)
IF Exists (select 1 where month(getdate()) IN (1,3,5,7,8,10,12)
)
i am not getting the solution for the error which this code is generting, can any one help me.
Shiv
What error are you getting? The code you posted works fine.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply