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 |
|
mary_itohan
Posting Yak Master
191 Posts |
Posted - 2008-09-28 : 18:07:51
|
Hello,is it possible to return a value of varchar to a calling SP ?I Tried using a simple SP, But not workingCREATE PROCEDURE dbo.Get ( @return varchar(max) OUTPUT )ASSELECT @return = 'test'return @return Msg 245, Level 16, State 1, Procedure G, Line 5Conversion failed when converting the varchar value 'test' to data type int._____________________Yes O ! |
|
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2008-09-28 : 19:11:28
|
| Return only works with ints, but you can use an output parameter.CREATE PROCEDURE dbo.Get ( @return varchar(max) OUTPUT )ASSELECT @return = 'test'GODECLARE @OutputVar VARCHAR(MAX)EXEC dbo.Get @OutputVar OUTPUTSELECT @OutputVar --Gail ShawSQL Server MVP |
 |
|
|
mary_itohan
Posting Yak Master
191 Posts |
Posted - 2008-09-29 : 03:55:57
|
| thank u_____________________Yes O ! |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-09-29 : 06:07:32
|
This type of question, "how to return char data from sp" has now been asked 8 times last few days.Are all attending same class? E 12°55'05.63"N 56°04'39.26" |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-29 : 06:22:54
|
| suggest you go through the below link to get an idea of how to return value through stored procshttp://www.sqlteam.com/article/stored-procedures-returning-data |
 |
|
|
doco
Yak Posting Veteran
77 Posts |
Posted - 2008-09-30 : 00:30:29
|
quote: Originally posted by Peso This type of question, "how to return char data from sp" has now been asked 8 times last few days.Are all attending same class?
They were supposed to and didn't - so they missed the part about stored procedures... Education is what you have after you've forgotten everything you learned in school |
 |
|
|
|
|
|