SQL Server - How to delete null values in a row?

Asked By Prasad Arun on 12-Nov-08 01:24 AM
when i executed the statement,



DEPTNO DNAME                LOCATION

------- -------------------- -------------------

80 manager              guntur

40 software             taranaka

34 GM                   pune



100 GM                   hyd







now, i want to delete the empty(null) row in the table.



How can i delete it?




msnews.microsoft.com replied on 12-Nov-08 01:36 AM
Prasad,

NULL and empty ('') are different. When you query, SELECT * FROM tablename
WHERE deptno is NULL, it shows the NULL values. From the output you listed,
there aren't any NULL values. They are empty ones. So you can delete them by
doing DELETE FROM tablename WHERE deptno = '' AND dname ='' AND location =
''

Also, you can check the length of the column (LEN)

hth,
Abba
prabhakar replied on 27-May-09 02:56 AM
You are required to be a member to post replies.  After logging in or becoming a member, you will be redirected back to this page.