Monday, 2 May 2011

SQL Delete

he DELETE statement is used to delete rows in a table

SQL DELETE Syntax
DELETE FROM table_name
WHERE some_column=some_value

The "custmast" table

custcode
custname
city
qty
rate
1
Siva
Srivilliputtur
50
70
2
Bala
Sivakasi
30
56
3
Kanna
Chennai
100
200
4
Vijay
Chennai
30
30
5
Kodee
Srivilliputtur
60
30
5
Kodee
Srivilliputtur
60
30
Example : 1

Delete from custmast where custcode=5
custcode
custname
city
qty
rate
1
Siva
Virudhunagar
50
70
2
Bala
Sivakasi
30
56
3
Kanna
Chennai
100
200
4
Vijay
Chennai
30
30
Example 2:

Delete from custmast where city='Chennai'
custcode
custname
city
qty
rate
1
Siva
Virudhunagar
50
70
2
Bala
Sivakasi
30
56
Delete All Records 

Delete from Custmast

custcode
custname
city
qty
rate






Delete * from custmast 

Error :  Incorrect syntax near '*'.

Notes :  Not use * Delete query in Sql server

 Share This Post


Friendly Learn Translate to Tamil

Smilely

Services

© 2014