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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you create a text that includes comma's ?

Status
Not open for further replies.

GJP55

Technical User
Feb 2, 2003
220
GB
I am trying to set a value in a variable and include the comma's as part of the value.

ie
Declare @MyValue as varchar(200)
Set @myValue = 'Test Value'

But I actually want to include the comma's (').

How is this done, I have tried "'TestValue'" and "'" + 'Test Value' + "'"

but both fail.

Thanks
 
Problem solved using char(39) + 'Test Value' + char(39)
 

Code:
Set @myValue = char(39) + 'Test Value' + char(39) -- 39 is ASCII Value of (')

[blue] or [/blue]

Set @myValue = '''Test Value'''  -- Add one more single quotes (') for each you want to insert

  both will give you same results


Regards,


"There are no secrets to success. It is the result of preparation, hard work, and learning from failure." -- Colin Powell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top