删除SQL Server中不需要的数据

时间:2016-09-23 03:39:06

标签: sql-server database

我想删除记录中不需要的数据,但我的查询不正确。谁能帮帮我吗??我想保留像这样的'X | D_1234','X | D_8743'和& 'X | D_0588',我想删除这样的记录'nmy name is mary'& “我的年龄是22岁。”

 delete from dbo.[MEOW] 
 where (STUDENT_ID NOT LIKE 'X|D_')

2 个答案:

答案 0 :(得分:0)

你可以在下面找到它们

    delete from dbo.[MEOW] 
    WHERE STUDENT_ID NOT LIKE '%[a-z0-9]%'

答案 1 :(得分:0)

只需在查询中使用like命令即可完成此操作

delete from dbo.[MEOW] where STUDENT_ID not like 'X|D_%'
---X|D_% will match from starting position
---%X|D_ will match from ending position
---%X|D_% will match in whole