|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Friday, July 27, 2012 2:55 PM
Points: 22,
Visits: 79
|
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, July 01, 2008 2:13 AM
Points: 1,
Visits: 11
|
|
| This is a very good article for starters like me.
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 7:18 AM
Points: 33,112,
Visits: 27,038
|
|
I know it's an older article, but I gotta say, nicely done, Kathi! Great examples for folks that don't know.
--Jeff Moden "RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".
First step towards the paradigm shift of writing Set Based code: Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Friday, May 31, 2013 2:54 PM
Points: 769,
Visits: 216
|
|
Thanks, guys! This has been my most popular article. Glad that I have been able to help lots of people.
Aunt Kathi Microsoft (Former SQL Server MVP)
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Saturday, May 04, 2013 5:21 AM
Points: 52,
Visits: 117
|
|
Kathi,
Great article.
One thing I wanted to add, which threw me for a loop a while back, is that if you use a return value when filling a datareader object that return value isn't available in vb.net code until after the datareader has iterated through all of its rows and closed. Which to me seems backwards. I always wanted to use the return value to make sure the SP didn't error-off and then run through my reader, but the return value isn't available until after I'd run through the reader. Weird.
George H.
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Yesterday @ 9:49 AM
Points: 13,436,
Visits: 25,281
|
|
|
|
|
|
SSCoach
         
Group: General Forum Members
Last Login: 2 days ago @ 1:45 PM
Points: 15,442,
Visits: 9,572
|
|
Good article.
One thing I like to include in parameter names is the direction. For example, "@Date_in" would be an input parameter, "@Date_out" would be an output parameter, "@Date_both" would be both.
Variables declared in the body of the proc don't have either. (e.g.: "@Date")
It makes it easier when I'm debugging or refactoring a proc, to be able to tell at a glance, whether I'm looking at an input parameter, an output parameter, or an internal variable.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Friday, May 31, 2013 2:54 PM
Points: 769,
Visits: 216
|
|
Great idea!
Aunt Kathi Microsoft (Former SQL Server MVP)
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Wednesday, July 22, 2009 3:49 AM
Points: 4,
Visits: 23
|
|
The Logic given below has really finished my doubt which i was having in retrieving the output parameter in sql queries... I knew it how to fetch the output from front end and actually itried like this in sql queries but i forgot that at the time of retrieval we give output identifier that's why i was making mistake in the retrieval ....
Thanx,
Regards Praveen
ALTER PROC usp_AddTwoIntegers @FirstNumber int = 5, @SecondNumber int, @Answer varchar(30) OUTPUT as Set @Answer = 'The answer is ' + convert(varchar,@FirstNumber + @SecondNumber)
Declare @a int, @b int, @c varchar(30) Select @a = 1, @b = 3 Exec usp_AddTwoIntegers @a, @b, @c OUTPUT Select @c
|
|
|
|