Pages

Tuesday, 29 May 2012

How To Delete a null record in SQL Server


How To Delete a null record


--create a table
create table employee(
emp_name varchar(50),
salary int)

--insert data in table
insert into employee values ('Rohit',10000)
insert into employee values ('Rahul',NULL)
insert into employee values ('Ravi',NULL)

--To see the data
select * from employee

--delete all null record
delete employee where salary=null
--result after above code - (0 row(s) affected)

*******************************************************

--for delete null record we use 'is'
delete employee where salary is null
--result after above code - (2 row(s) affected)

No comments:

Post a Comment