You would have to use a dynamic query to do this. eg:
Code:
DECLARE @SQL nvarchar(MAX)
SET @SQL = 'SELECT Col1, Col2'
/* include Col3 only on the 15th of each month. */
SET @SQL = @SQL +(CASE WHEN DATEPART(d, GETDATE()) = 15 THEN ', Col3' ELSE '' END)
SET @SQL = @SQL + ' FROM Tab1'
EXEC sp_executesql @SQL
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.