Home > database >  Consult with SQL server to delete
Consult with SQL server to delete

Time:09-26

Library is a field of type vchar, but the deposit is in the form of Numbers, such as 6000333, 0200 integer string, you want to delete all records within the scope of the two Numbers, such as delete all data within 3000-5000, how to write?
String sql_del="delete from man where cabNum & gt;='" + txtStartNum. Text + "' and cabNum & lt; '" + txtEndNum. Text + "' ";
It seems wrong,

CodePudding user response:

 

The delete from man where cabNum Between '3000' And '5000'

CodePudding user response:

String type is unable to directly compare the size of the you and cast (field as int) try again

CodePudding user response:

 DELETE FROM man where CAST (cabNum AS INT) BETWEEN 3000 AND 5000, 

The DELETE FROM man where CAST (cabNum AS INT) & gt;=3000 AND CAST (cabNum AS INT) & lt;=5000
both should be ok
  • Related