sql - Output year and month with a string -


trying output like:

2016,11

using this:

select convert(varchar(20),year(getdate()) + ',' + month(getdate())) yearmonth 

am missing in convert? because getting error:

conversion failed when converting varchar value ',' data type int.

thanks

try this.

select convert(varchar(20),year(getdate())) + ',' + convert(varchar(20),  month(getdate())) yearmonth 

Comments

Popular posts from this blog

php - trouble displaying mysqli database results in correct order -

depending on nth recurrence of job in control M -

sql server - Cannot query correctly (MSSQL - PHP - JSON) -