October 12, 2009 at 5:04 am
In my table i stored the collection of files with delimit within a single column as follows
"aSample_1_scrShot_2009-01-02_09-15-51.png^aSample_2_scrShot_2009-01-12_09-00-07.png^ASAMPLE_3_scrShot - _2009-01-23_10-51-19.png^
ASAMPLE_4_scrShot_2008-12-31_17-58-17.png^ASAMPLE_5_scrShot_2009-01-02_09-15-06.png^ASAMPLE_6_scrShot - _2009-03-05_09-56-31.png^
ASAMPLE_7_scrSht-_2009-04-10_10-37-53.png^"
i want to search for particular string and i have to remove that matched string in that collection, and leaving the other content in that column
For Example :
I want to remove string means i have to give input as "ASAMPLE_5_scrShot_2009-01-02_09-15-06.png^" the result should be return the remaining content
"aSample_1_scrShot_2009-01-02_09-15-51.png^aSample_2_scrShot_2009-01-12_09-00-07.png^ASAMPLE_3_scrShot - _2009-01-23_10-51-19.png^
ASAMPLE_4_scrShot_2008-12-31_17-58-17.png^ASAMPLE_6_scrShot - _2009-03-05_09-56-31.png^
ASAMPLE_7_scrSht-_2009-04-10_10-37-53.png^"
how can i achieve this,
guidance needed,
thanks in advance
___
Known Is An Drop,Unknown Is An Ocean....
Njoy Programming 🙂
October 12, 2009 at 5:43 am
update <Table_name> set <column_name>=REPLACE(<column_name>,'ASAMPLE_5_scrShot_2009-01-02_09-15-06.png','')
..
October 12, 2009 at 6:09 am
I Found the solution
declare @STR varchar(1000)
set @STR = 'aSample_1_scrShot_2009-01-02_09-15-51.png^aSample_2_scrShot_2009-01-12_09-00-07.png^ASAMPLE_3_scrShot - _2009-01-23_10-51-19.png^ASAMPLE_4_scrShot_2008-12-31_17-58-17.png^ASAMPLE_5_scrShot_2009-01-02_09-15-06.png^ASAMPLE_6_scrShot - _2009-03-05_09-56-31.png^ASAMPLE_7_scrSht-_2009-04-10_10-37-53.png^'
select REPLACE(@str, 'ASAMPLE_5_scrShot_2009-01-02_09-15-06.png^', '')
___
Known Is An Drop,Unknown Is An Ocean....
Njoy Programming 🙂
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply