Jack Jack - 11 months ago 45
SQL Question

SQL Query custom result

I have Query like

Select CONCAT('"',CONVERT(date,getdate()),'"')

It will result like


but I want single quote in result like '2016-07-15'

If i used Select CONCAT(''',CONVERT(date,getdate()),''')
It will give me error.

can anyone help me to sort this out.


Try this:

SELECT CONCAT('''',CONVERT(date,getdate()),'''')

In SQL Server you have to double single quotes up in order to escape them.