January 19, 2005 at 12:55 pm
Hi,
I can't list just month and year - in only column - from a date columnn. When I try this
SELECT MONTH(DATE) & YEAR(DATE) AS MONTHYEAR FROM TABLE
return all 0 in column.
Can you help me?
thanks
Mairim
January 19, 2005 at 1:04 pm
SELECT CAST(MONTH(GETDATE()) AS VARCHAR(2)) + CAST(YEAR(GETDATE()) AS CHAR(4))
Good Hunting!
AJ Ahrens
webmaster@kritter.net
January 19, 2005 at 10:56 pm
SELECT MONTH(DATE) & YEAR(DATE) AS MONTHYEAR FROM TABLE
& is performing a bitwise AND between the month and year outputs.
In Sql Server you use + to concatenate values together, but you will need to convert those values to strings first, just like in A J's code in the post above.
Julian Kuiters
juliankuiters.id.au
January 20, 2005 at 5:27 am
AJ
Thank you, very much!!!
Mairim
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply