| Author |
Topic |
|
sqllover
Constraint Violating Yak Guru
338 Posts |
Posted - 2008-11-13 : 05:55:26
|
| Dear Friend,In oracle there are In,out,InOut Parameter passing is available.In sqlserver In and Out is possible. Is there InOut parameter available in sqlserver? if means please let me know. |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2008-11-13 : 06:03:53
|
| you mean in the stored procedures? the out parameter is used for this._______________________________________________Causing trouble since 1980Blog: http://weblogs.sqlteam.com/mladenpSpeed up SSMS development: www.ssmstoolspack.com <- version 1.1 out! |
 |
|
|
sqllover
Constraint Violating Yak Guru
338 Posts |
Posted - 2008-11-13 : 06:20:27
|
| thank you friend |
 |
|
|
lionofdezert
Aged Yak Warrior
885 Posts |
Posted - 2008-11-13 : 06:27:52
|
| Only difference is INOut keyword, these is no such keyword used in sql server. Only OUTPUT keyword is used and also u need to mention IN keyword for IN parameter. |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-11-13 : 06:31:45
|
All parameters in SQL Server are by default IN parameters.You only need to specify OUT[PUT] if you want it to be OUTPUT parameter too. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
sqllover
Constraint Violating Yak Guru
338 Posts |
Posted - 2008-11-13 : 23:54:00
|
hi, as per your advice i have done some sample.ths is my code:CREATE PROCEDURE [dbo].[SP_GetEmpDetails](@name varchar(50) output,@Empsalary int output)as BEGIN set @name =(select EmpID from EmpDetails where EmpName=@name) set @Empsalary =(select salary from EmpDetails where EmpName=@name)select @name,@Empsalary ENDhere i used @name as in and out purpose.@Empsalary as out parameter. when i execute it shows Empid as correct.but Empsalary as null. what could be the reason and please help me to solve this issue |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-14 : 00:49:56
|
| how were you executing the sp? |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-11-14 : 02:09:03
|
Your first set statement replaces/overwrites value for @name parameter with ID for employee!CREATE PROCEDURE [dbo].[SP_GetEmpDetails](@name varchar(50) output,@Empsalary int output)as BEGIN set @name =(select EmpID from EmpDetails where EmpName=@name) set @Empsalary =(select salary from EmpDetails where Empid=@name)select @name,@Empsalary E 12°55'05.63"N 56°04'39.26" |
 |
|
|
sqllover
Constraint Violating Yak Guru
338 Posts |
Posted - 2008-11-14 : 03:40:28
|
| thanks friends.could it be done using cursors? if means please show me some example please |
 |
|
|
vinayakshukre
Starting Member
11 Posts |
Posted - 2009-01-01 : 00:43:29
|
| Thanks a ton. I was also looking for the same i.e. inout in ms sql server. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-01 : 13:04:38
|
quote: Originally posted by sqllover thanks friends.could it be done using cursors? if means please show me some example please
yup it can be. but can i ask why you need cursor to return some value? cant a set based solution be enough? |
 |
|
|
pankaj.todkar
Starting Member
1 Post |
Posted - 2011-04-29 : 06:50:11
|
| CREATE PROCEDURE [dbo].[SP_GetEmpDetails](@name varchar(50) output,@Empsalary int output)as BEGIN set @Empsalary =(select salary from EmpDetails where EmpName=@name) set @name =(select EmpID from EmpDetails where EmpName=@name)select @name,@Empsalary ENDHighlighted lines exchanged can resolve Your Problem too..Rgds,Pankaj Todkar |
 |
|
|
raghuveer125
Constraint Violating Yak Guru
285 Posts |
|
|
|