Pages

Men

rh

10/22/2013

How to write Case Statement in Update Statement in SQL Server

 Example :-

UPDATE dbo.Tbl_Employee
        SET LastName = 

                       (  
                        CASE WHEN (DepartmentName = 'EDP') THEN  FirstName+ '-'+ LastName
                        ELSE (LastName+ '.'+ FirstName)
                        END
                        )

No comments :

Post a Comment