Sunday, February 19, 2012

Display quote in data using select statement

Hi,

I want to display data in the below format, please help me how to get this?

Data

'Employee1',Accountant

'Employee2',Programmer

I gave the select statment like this but it is not taking

SELECT '" + employeename + '" + departmentname from empdept

Please help me how to display quotes before and after the employeename.

Thank you

You need two quotes within quotes (thus four if a standalone quote) to display quotes in SQL, not three, hence:

SELECT ''" + employeename + ''" + departmentname from empdept

HTH

For more SQL tips, check out my blog:

No comments:

Post a Comment