• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 133
  • Last Modified:

SQL Query assistance


Need to write a script to do the following

delete from GLF_BAT_LNE where  LEFT(accnbri, 3)  is not equal to the following "201", "202", "203", "207", "211"

  • 2
2 Solutions
Aneesh RetnakaranDatabase AdministratorCommented:
delete from GLF_BAT_LNE where  LEFT(accnbri, 3)  not in ('201', '202' ,'203', '207', '211' )
Matthew34Author Commented:
Thanks how can I run a number of similar queries all at once?
Aneesh RetnakaranDatabase AdministratorCommented:
something like this in a transaction block. depending on the size of the tables, it may cause some performance issues, prefer to do this offpeak hours

begin tran
delete from GLF_BAT_LNE1 where  LEFT(accnbri, 3)  not in ('201', '202' ,'203', '207', '211' )
delete from anotherTable  where  LEFT(anothreColumn, 3)  not in ('2we')
commit tran
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now