To get only month and year from date in sql server we need to write the query like this
SELECT CONVERT(CHAR(4), yourdatecolumn, 100) + CONVERT(CHAR(4), yourdatecolumn, 120)FROM yourtablename
|
Example
SELECT CONVERT(CHAR(4), getdate(), 100) + CONVERT(CHAR(4), getdate(), 120)
|
Once we run above query we will get output like as shown below
Output
Output
No comments:
Post a Comment