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 |
|
mailtosaja
Starting Member
28 Posts |
Posted - 2008-08-05 : 08:28:04
|
| Hi, Empid Empname Empadd ---------------------------- 1 Jess Chennai 1 Jess1 Chennai 1 Jess Chennai 1 NULL ChennaiI have above table with Data.Below one sp i was used..What i want is user should pass the Empid and EmpName is optional..I was execute the sp (test_1 1,null) .I didn't get the full data..if any body please tell me..create procedure test_1( @empid as int, @empname varchar(max)=null)asBEGINselect * from x where Empid=@empid and ( (@empname is null and Empname=Empname) or (Empname=@empname) )ENDThanks & Regards,S.Jess |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-08-05 : 08:33:50
|
| create procedure test_1(@empid as int,@empname varchar(max)=null)asBEGINselect * from xwhere Empid=@empid and (@empname is null or Empname=@Empname)ENDMadhivananFailing to plan is Planning to fail |
 |
|
|
mailtosaja
Starting Member
28 Posts |
Posted - 2008-08-05 : 09:03:36
|
| Hi, I got the answer man..thanks a lot....Thanks & Regards,S.Sajan |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-08-05 : 09:38:23
|
quote: Originally posted by mailtosaja Hi, I got the answer man..thanks a lot....Thanks & Regards,S.Sajan
You are welcome MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|