all groups > sql server programming > december 2006 >
You're in the

sql server programming

group:

How can I use \ character on the end of the string in STRCAT


How can I use \ character on the end of the string in STRCAT shnel
12/9/2006 11:47:10 PM
sql server programming:
Hi,
I am trying to do STRCAT of a string that ends with \.
For some reason I set an error message (unclosed string).
Any ideas?
Re: How can I use \ character on the end of the string in STRCAT Uri Dimant
12/10/2006 12:00:00 AM
shnel

DECLARE @st1 VARCHAR(20),@st2 VARCHAR(20),@stsql VARCHAR(50)

SET @st1='Hello\'
SET @st2='World\'

SET @stsql=@st1+@st2
SELECT @stsql







[quoted text, click to view]

Re: How can I use \ character on the end of the string in STRCAT Erland Sommarskog
12/10/2006 12:00:00 AM
shnel (snirhe10@gmail.com) writes:
[quoted text, click to view]

I would guess that you need to double the \\. But since \ does not
have any meaning in SQL Server strings(*) and there is no STRCAT, I think
you are using a different product.


(*) Ok, so that is not really true. There is one case where \ matters:

select 'select \
backslash'




--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
AddThis Social Bookmark Button