May 8, 2007 at 3:31 pm
Hello
I need to know in TSQL query i can find in string only a part of string.
For example :
my string : 24302331 - IVA a 21% OBS
i need to keep only 24302331 , in VFP the following code return this value beginning from the left until find "-" for keeping the value of "24302331"
VFP code : alltrim(SUBSTR(alltrim(Curs1.oldesc), 1, AT("-",alltrim(curs1.oldesc))-1))
I need that to update one field on my table , the value of "24302331" is my account.
Many thanks
Luis Santos
May 8, 2007 at 3:44 pm
Something like this perhaps?
DECLARE @inString varchar(50)
SET @inString = '24302331 - IVA a 21% OBS'
print LEFT(@inString, CHARINDEX('-', @inString) - 1)
May 8, 2007 at 4:09 pm
Hello Stef
Many thanks for your help, your code work very fine and also it´s very similar to VFP that i use on my Client/Server application to build code against SQL Server Database.
Bye and Thank you
Luis Santos
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply