Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 substring & concat

Author  Topic 

Amber_Deslaurier
Starting Member

40 Posts

Posted - 2010-07-02 : 18:08:20
Hi!

Is there an easier way to do this? I want to add a ' (begining and end of value) and a , (at the end) to a text (varchar) value... I think there will be an error especially with the single quote...

My code:

||'''||SUBSTRING EMP (1,7) ||'''|| ||','|| as EMPNO,

Thank you,

Amber.

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2010-07-02 : 19:01:47
Is that Microsoft SQL Server? To do this in MS SQL Server you would just do this
select '''' + SUBSTRING EMP (1,7) + ''','

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page
   

- Advertisement -