Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
vaux17
Starting Member
1 Post |
Posted - 2011-05-26 : 06:00:20
|
In my example I am trying replace some values by an other one .The SP below is fully validated but the problem is that I find no way to allocate Emp_Name to @Emp_Name without getting an error message.My goal is to use the SP to replace AAA by BBB .The value AAA belongs to the attribute Emp_Name .How would you proceed to allocate Emp_Name to @Emp_NameEmp_Number Emp_Name Emp_Hiredate1 AAA 260166 2 BBB 260167 create PROCEDURE GET_EMP_REC8@Emp_Number int, @Emp_Name varchar(20) OUTPUT, @Emp_Hiredate datetime OUTPUT asSELECT @Emp_Hiredate= Emp_Hiredate , (CASE @Emp_Name WHEN 'AAA' THEN 'BBB' ELSE 'UNKNOWN'END) FROM Employee WHERE empno = @Emp_Number RETURN 0Fab |
|
jfarrugia
Yak Posting Veteran
55 Posts |
Posted - 2011-05-26 : 06:16:26
|
have you tried?-- first two lines just for testingdeclare @Emp_Name as varchar(50)set @Emp_Name = 'AAA'select CASE WHEN @Emp_Name = 'AAA' THEN 'BBB' ENDWhere software development knowledge meets the reader |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2011-05-26 : 06:17:00
|
SELECT @Emp_Hiredate= Emp_Hiredate , @Emp_Name = (CASE WHEN Emp_Name = 'AAA' THEN 'BBB' ELSE 'UNKNOWN'END) FROM Employee WHERE Emp_Number = @Emp_Number RETURN 0 |
|
|
|
|
|