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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 issue with TRIM

Author  Topic 

sqllearner
Aged Yak Warrior

639 Posts

Posted - 2004-12-08 : 18:20:47
Iam trying to get the name as

declare @test varchar(500)
set @test='image/tiff;name="1.TIF"'

select RTRIM(LTRIM(replace(SUBSTRING(@test,CHARINDEX('=',@test,1)+1,LEN(@test)),'"','')))AS proc_name

Here I get proc_name as 1.TIF and is there any other way to trim and get the result.

once more thing is to get the another value called 'TIF'out of the name="1.TIF" as extension

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2004-12-08 : 21:12:25
declare @test varchar(500)
set @test='image/tiff;name="1.TIF"'


print replace(right(@test,len(@test)-charindex('"',@test,1)),'"','')

print replace(right(@test,len(@test)-charindex('.',@test,1)),'"','')

hth

--------------------
keeping it simple...
Go to Top of Page
   

- Advertisement -