Jack Jack - 4 months ago 12
SQL Question

SQL Query custom result

I have Query like

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

It will result like

"2016-07-15"

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.
Thanks.

Answer

Try this:

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

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