Click here to Skip to main content
12,404,178 members (75,910 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: SQL-Server
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 ,

update tbl_account
set DefaultEmp='False'
where (tbl_account.Id <> 3) and DeptId=5
could you please help me...

Thanks
Posted 29-May-12 22:05pm
moon20111.1K
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 .
djj55 30-May-12 9:16am
   
Does tbl_account.ID have any nulls?
   
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 30 May 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100