Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with select statement

Status
Not open for further replies.

edwardturner

Technical User
Jul 13, 2005
25
GB
Hi,

I need to write a select statement to just return one field from a table but i want to also return a column either site that just contains a ' character. I know how to say add a column before / after a column:

select field, ',' from table

But i do not know how I would get the single quote character either side.

Any ideas?
 
You just need to double up the single quote:

Code:
SELECT field, '''' FROM table

--James
 
I'm not sure I understood what you need, is this is:
Code:
select ','+field+','
?

"A long life is when each day is full and every hour wide!"
(A Jewish Mentor)
M. [hourglass]

 
You could use either of these, depending on what you want to end up with:

select '''' QL, 'a' COL, '''' QR
returns 3 cols:
QL COL QR
' a '

select '''' + 'a' + '''' QL_COL_QR
returns one col:
QL_COL_QR
'a'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top