日期:2014-05-18  浏览次数:20434 次

where 筛选 如何删除。谢谢。
现我有:如下这个字段
CODE
00070001
0008
0007
00070002
000700010001

我要执行这个操作。比如我现在点中了0007这个字段。要删除他所在的行。但删除他这行的同时,也要删除00070001,与00070002与000700020001这些行。请问我如何来做where的条件判断。来判断前四个为我选的0007这个东东。谢谢高手。

------解决方案--------------------
where 字段 like @input+ '% '
------解决方案--------------------
where charindex( '0007 ' ,code) > 0
------解决方案--------------------
delete from aa where cyear like '0007% '
------解决方案--------------------
declare @CODE as varchar(10)
set @code = '0007 '

delete from tb where charindex(@code , code) > 0

declare @CODE as varchar(10)
set @code = '%0007 '
delete from tb where code like @code