Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL
This Query is Work : use for insert
INSERT INTO Employee VALUES(@EmployeeID,@EmployeeName,@Emp_Title,@Address_1, @Address_2,@Area, case when @City<=0 then null else @City end,
        @Postcode,@JoiningDate,@BirthDate,@LeavingDate,case when @DepartmentID <=0 then null else @DepartmentID end, case when @DesignationID<=0 then null else @DesignationID end, @MobileNo,@Office_PhoneNo,@Residence_PhoneNo,@Email_ID,@Active);
 
i also want to use case here but not Works
Update Employee Set EmployeeName=@EmployeeName,Emp_Title=@Emp_Title,Address_1=@Address_1,Address_2=@Address_2,Area=@Area,City=@City,Postcode=@Postcode,JoiningDate=@JoiningDate,BirthDate=@BirthDate,LeavingDate=@LeavingDate,DepartmentID=@DepartmentID,DesignationID=@DesignationID,MobileNo=@MobileNo,Office_PhoneNo=@Office_PhoneNo,Residence_PhoneNo=@Residence_PhoneNo,Email_ID=@Email_ID,Active=@Active WHERE EmployeeID =  @EmployeeID
 

any one help me to out This...!!
Posted 15-Sep-12 1:04am
Edited 15-Sep-12 1:28am
Raje_6.8K
v2
Comments
tarun0702 at 15-Sep-12 7:06am
   
both are same query but only change is Case condition
Ganesh Nikam at 15-Sep-12 7:28am
   
can you specify what is error
__TR__ at 15-Sep-12 7:30am
   
What's the error message you got ?
tarun0702 at 19-Sep-12 8:09am
   
i Solved Problem Thx....
Pete O'Hanlon at 19-Sep-12 10:14am
   
I have removed your abusive comments below. They are not acceptable on a site like Code Project. In future, please try not to be abusive.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi,
 
Check http://www.bennadel.com/blog/933-Using-CASE-Statements-In-A-SQL-UPDATE-Query.htm[^] very simple but it will explain Case in Update query.
 
Hope you got the answer from this link,
  Permalink  
Comments
tarun0702 at 15-Sep-12 7:43am
   
Perfect Ans.
 
Thx a lot....:)
@amitgajjar at 15-Sep-12 7:43am
   
Your welcome dear.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Finally. i got solution for this Problem.
problem is circular execute SP.
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 446
1 OriginalGriff 380
2 Yogesh Kumar Tyagi 304
3 Prakriti Goyal 200
4 Maciej Los 165
0 OriginalGriff 6,472
1 Sergey Alexandrovich Kryukov 5,404
2 Maciej Los 3,434
3 Peter Leow 3,259
4 DamithSL 2,495


Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 19 Sep 2012
Copyright © CodeProject, 1999-2014
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