Wednesday, March 28, 2012

If Else problem

I am trying to implement the correction for daylight savings

hence I have the code as

IF DATEPART(yy,GetDATE())>= 2007
{SET @.i=......................

new code

}

[ELSE

{ SET...

old code

}]

This gives me teh error as

[Microsoft][ODBC SQL Server Driver]Syntax error or access violation

What is going wrong here

thanks

kiran

Hello Kiran,

I think you need to have something like this:

IF DATEPART(yy,GetDATE())>= 2007
BEGIN
... New Code ...
END
ELSE
BEGIN
... Old Code ...
END

Hope this helps.

Jarret

|||Try running your query in Query Analyzer or Management Studio before using it in Reporting Services. You will get more helpful error messages that will help you debug your query.|||

thank you guys,

I will use query analyzer from now on..

No comments:

Post a Comment