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.
Author |
Topic |
asifbhura
Posting Yak Master
165 Posts |
Posted - 2012-12-18 : 06:22:00
|
Hello,I have two columns stcode, stnamei have data likestcode stnameAB001 XYZ2AB001 XYZAB002 AAA2AB002 AAAI want to delete all records which are having Stcode which start with 2regards, |
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2012-12-18 : 06:28:22
|
DELETE FROM TableName WHERE LEFT(stcode,1) = '2'--Chandu |
|
|
sunriser
Starting Member
14 Posts |
Posted - 2012-12-18 : 06:36:28
|
delete from tablenamewherestcode like '2%'sunriser |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-12-19 : 03:34:52
|
quote: Originally posted by bandi DELETE FROM TableName WHERE LEFT(stcode,1) = '2'--Chandu
might cause it to ignore an index if present on stcode column as predicate becomes non sargeable------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|