February 25, 2009 at 10:25 pm
February 26, 2009 at 12:29 am
DECLARE @a varchar(10) -- declaration of variable
SET @a = DATEPART(YEAR,DATEADD(YEAR,0,'01/01/2009'))
DECLARE @SQL NVARCHAR(200)
SELECT @SQL = 'SELECT CASE WHEN 2009 = 2009 THEN 1
ELSE 0
END AS '+ QUOTENAME(@A) +''
EXECUTE( @SQL)
John Smith
February 26, 2009 at 5:43 am
it works.
thanks mangal.
February 26, 2009 at 11:14 pm
Just curious... why do you need to do this?
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply