Jack Jack - 1 year ago 71
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.

Answer Source

Try this:

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

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download