Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all
i want to update all my rows in a table except one row , i have tried that code but it didn't affect in any row ,

SQL
update tbl_account
set DefaultEmp='False'
where (tbl_account.Id <> 3) and DeptId=5

could you please help me...

Thanks
Posted
Comments
Om Prakash Pant 30-May-12 4:22am    
if your table has primary key then this should be simple
RDBurmon 30-May-12 4:47am    
Hello Moon , Please post your table structure and data in tbl_account. It would be helpful to understand the scenario and easy for member to provide effective answer .
Corporal Agarn 30-May-12 9:16am    
Does tbl_account.ID have any nulls?
Kaushik Saha from Kolkata,India 18-Jul-12 1:22am    
It means you want to update all data which Dept_ID=5 except which ID=3.
ypur DML query work above operation.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900