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 2005 Forums
 Transact-SQL (2005)
 update query

Author  Topic 

menahem
Starting Member

3 Posts

Posted - 2008-08-06 : 13:25:31
hi
i want to make an update query that goes like that
update table set Col1 = Col1 - 'abc'

that means that i want to delete all the 'abc' strings from the Col1 column

thanks,


visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-06 : 13:29:02
UPDATE table
SET Col1=NULL
WHERE Col1='abc'
Go to Top of Page

menahem
Starting Member

3 Posts

Posted - 2008-08-06 : 13:38:53
well No

i want to delete the 'abc' string from Col1 but this column can include also the 'def' string etc

lets say that col1 have the string 'abc def ghi'
and i want to change it to 'def ghi'
what is the query for that??
thanks,
Go to Top of Page

bjoerns
Posting Yak Master

154 Posts

Posted - 2008-08-06 : 13:39:17
Or maybe set Col1 = replace(Col1, 'abc', '')? What output do you expect from
'abc'
'abcsomething'
'somethingabc'?
Go to Top of Page

menahem
Starting Member

3 Posts

Posted - 2008-08-06 : 13:48:05
thanks
that what i needed

the replace function
Go to Top of Page
   

- Advertisement -