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
 delete

Author  Topic 

cwtriguns2002
Constraint Violating Yak Guru

272 Posts

Posted - 2007-04-18 : 02:00:42
Hi everyone. Im here again to ask help.

DECLARE @myString varchar(max)
SET @myString = 'abcdefghijklmnop'

How could I delete the first and last letter of the string?

Thanks :)

-Ron-

"If you can only access one site on the Internet, make it SQLTeam!"

nr
SQLTeam MVY

12543 Posts

Posted - 2007-04-18 : 02:05:43
select @myString = substring(@myString,2,len(myString)-2)


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

spejbl
Starting Member

28 Posts

Posted - 2007-04-18 : 02:06:15
[code]SELECT SUBSTRING(@myString, 2, LEN(@myString)-2)[/code]

--
Tom
Microsoft KB articles monitoring | Apple KB articles monitoring
Go to Top of Page
   

- Advertisement -