| Author |
Topic |
|
karthik
Starting Member
8 Posts |
Posted - 2007-12-03 : 07:41:52
|
| create PROCEDURE [dbo].[SPName](@Field1 varchar(50) = NULL output,@Field2 varchar(50) = NULL output,)ASSelect Field1,Field2,Field3 from table1 where PK=1Above is the simple SP, Here i want to return fields to output parameter not as table. What is the best solution |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-12-03 : 07:44:17
|
quote: Originally posted by karthik
create PROCEDURE [dbo].[SPName]( @Field1 varchar(50) = NULL output, @Field2 varchar(50) = NULL output)AS Select @Field1 = Field1, @Field2 = Field2 from table1 RETURNGO Above is the simple SP, Here i want to return fields to output parameter not as table. What is the best solution
Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
ayamas
Aged Yak Warrior
552 Posts |
Posted - 2007-12-03 : 08:03:09
|
quote: Originally posted by karthik create PROCEDURE [dbo].[SPName]( @Field1 varchar(50) = NULL output, @Field2 varchar(50) = NULL output,)AS Select Field1,Field2 from table1 Above is the simple SP, Here i want to return fields to output parameter not as table. What is the best solution
But there is no where condition in the select statement?How will the parameters return single value if the select statement returns multiple records? |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-12-03 : 08:04:17
|
quote: Originally posted by ayamas
quote: Originally posted by karthik create PROCEDURE [dbo].[SPName]( @Field1 varchar(50) = NULL output, @Field2 varchar(50) = NULL output,)AS Select Field1,Field2 from table1 Above is the simple SP, Here i want to return fields to output parameter not as table. What is the best solution
But there is no where condition in the select statement?How will the parameters return single value if the select statement returns more than multiple records?
It would just retunr the last value assignedMadhivananFailing to plan is Planning to fail |
 |
|
|
karthik
Starting Member
8 Posts |
Posted - 2007-12-03 : 08:07:12
|
| I missed one field and where clause. Look at My first Post The query is Select Field1,Field2,Field3 from table1 where PK=1 |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-12-03 : 08:12:06
|
quote: Originally posted by karthik I missed one field The query is Select Field1,Field2,Field3 from table1
Well. Do you want to return single value for each parameter or multiple values?MadhivananFailing to plan is Planning to fail |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-12-03 : 08:34:57
|
| Well. You edited the reply but didnt answer to my questionMadhivananFailing to plan is Planning to fail |
 |
|
|
karthik
Starting Member
8 Posts |
Posted - 2007-12-03 : 08:49:44
|
quote: Originally posted by madhivanan Well. You edited the reply but didnt answer to my questionMadhivananFailing to plan is Planning to fail
Single Value |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-12-03 : 08:53:45
|
Trycreate PROCEDURE [dbo].[SPName]( @param1 varchar(50) = NULL output, @param2 varchar(50) = NULL output, @param3 varchar(50) = NULL output)AS Select @param1 = param1, @param2 = param2, @param3 = param3 from table1 where where PK=1 RETURNGO MadhivananFailing to plan is Planning to fail |
 |
|
|
|