Click here to Skip to main content
15,898,538 members
Home / Discussions / Database
   

Database

 
QuestionDebugging in SQL Server 2005 Pin
meeram3953-Jan-10 18:45
meeram3953-Jan-10 18:45 
AnswerRe: Debugging in SQL Server 2005 Pin
meeram3953-Jan-10 19:09
meeram3953-Jan-10 19:09 
QuestionMultiple values associated with a single value Pin
shrims4u2-Jan-10 22:19
shrims4u2-Jan-10 22:19 
AnswerRe: Multiple values associated with a single value Pin
Rob Philpott2-Jan-10 22:32
Rob Philpott2-Jan-10 22:32 
AnswerRe: Multiple values associated with a single value Pin
Corporal Agarn4-Jan-10 2:18
professionalCorporal Agarn4-Jan-10 2:18 
GeneralRe: Multiple values associated with a single value Pin
AmbiguousName4-Jan-10 7:32
AmbiguousName4-Jan-10 7:32 
QuestionBest Practices Q Pin
Member 45019402-Jan-10 8:55
Member 45019402-Jan-10 8:55 
AnswerRe: Best Practices Q Pin
DarrenShultz2-Jan-10 11:01
DarrenShultz2-Jan-10 11:01 
It really depends on how it is being used, and I personally use both techniques. I can't say I've read much on the benefits/pitfalls of each approach, but within T-SQL, I prefer the OUTPUT param simply to favor variable assignment rather than having a result set returned. If the stored procedure is being called from .NET, I usually SELECT out the record ID, and utilize the ExecuteScalar method of SqlCommand.

The T-SQL usage doesn't really favor one over the other (in terms of keystrokes):
EXECUTE StoredProc @Param1, @Param2, @RecordID OUTPUT

SET @RecordID = EXECUTE StoredProc @Param1, @Param2

OUTPUT Parameter:

If stored procedure is being called from within T-SQL.
If the new record ID is not always used by the caller.

SELECT Record ID:

If stored procedure is being called from .NET (use SqlCommmand.ExecuteScalar).
If the new record ID is always used by the caller.

If you do choose to take the OUTPUT parameter route, I would suggest you are careful about how you assign the new record ID to that OUTPUT parameter. If the stored proc is being called within a loop, you'll want to make sure the previous value does not remain in the output parameter (in the event that a record is not actually affected). You may also want to set the default value for that OUTPUT param as NULL so it is optional (in the event the caller does not require the record ID).
AnswerRe: Best Practices Q Pin
Eddy Vluggen2-Jan-10 23:43
professionalEddy Vluggen2-Jan-10 23:43 
QuestionMS SQL Server Not Updating Column Names Pin
Brendan Vogt2-Jan-10 1:51
Brendan Vogt2-Jan-10 1:51 
AnswerRe: MS SQL Server Not Updating Column Names Pin
Andy_L_J2-Jan-10 8:02
Andy_L_J2-Jan-10 8:02 
GeneralRe: MS SQL Server Not Updating Column Names Pin
Brendan Vogt3-Jan-10 1:38
Brendan Vogt3-Jan-10 1:38 
GeneralRe: MS SQL Server Not Updating Column Names Pin
Andy_L_J3-Jan-10 16:40
Andy_L_J3-Jan-10 16:40 
AnswerRe: MS SQL Server Not Updating Column Names Pin
Ashfield3-Jan-10 8:19
Ashfield3-Jan-10 8:19 
QuestionDatabase Name Pin
Brendan Vogt2-Jan-10 1:48
Brendan Vogt2-Jan-10 1:48 
AnswerRe: Database Name Pin
Eddy Vluggen2-Jan-10 4:55
professionalEddy Vluggen2-Jan-10 4:55 
AnswerRe: Database Name Pin
Mycroft Holmes2-Jan-10 17:14
professionalMycroft Holmes2-Jan-10 17:14 
GeneralRe: Database Name Pin
Brendan Vogt2-Jan-10 20:41
Brendan Vogt2-Jan-10 20:41 
GeneralRe: Database Name Pin
Mycroft Holmes2-Jan-10 22:50
professionalMycroft Holmes2-Jan-10 22:50 
GeneralRe: Database Name Pin
Brendan Vogt2-Jan-10 22:53
Brendan Vogt2-Jan-10 22:53 
GeneralRe: Database Name Pin
Eddy Vluggen2-Jan-10 23:33
professionalEddy Vluggen2-Jan-10 23:33 
AnswerRe: Database Name Pin
Brendan Vogt2-Jan-10 23:46
Brendan Vogt2-Jan-10 23:46 
QuestionMSSQL 7 Decryptor Pin
The_Collector1-Jan-10 21:10
The_Collector1-Jan-10 21:10 
Questionreturn value, Pin
Hema Bairavan1-Jan-10 20:09
Hema Bairavan1-Jan-10 20:09 
AnswerRe: return value, Pin
Blue_Boy1-Jan-10 22:29
Blue_Boy1-Jan-10 22:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.