Ok ,
I'm new in stored procedures, I created one, so I want to test it without
going and coding a program in C# or VB.NET, is it any way to run it where it
will ask my parameters and get the result using the SQL Enterprise Manager ?
ThanksEasiest in Query Analyzer:
EXEC usp_proc_name
@.param1 = 123,
@.param2 = 'ABC'
David Portas
SQL Server MVP
--|||In addition to executing within Query Analyzer, there is also a feature to
run the procedure step by step in debug mode. Read up on "Transact-SQL
Debugger" in Books Online or MSDN.
"Carlos" <cp@.swa.com> wrote in message
news:%23$UsSnCyFHA.2348@.TK2MSFTNGP15.phx.gbl...
> Ok ,
> I'm new in stored procedures, I created one, so I want to test it without
> going and coding a program in C# or VB.NET, is it any way to run it where
> it will ask my parameters and get the result using the SQL Enterprise
> Manager ?
> Thanks
>|||Ok I used the Query analyzer now where do I see my returned value ?
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:1128351195.556320.319300@.g49g2000cwa.googlegroups.com...
> Easiest in Query Analyzer:
> EXEC usp_proc_name
> @.param1 = 123,
> @.param2 = 'ABC'
> --
> David Portas
> SQL Server MVP
> --
>|||Pass a variable and specify OUTPUT. A nice feature of Query Analyzer is
that it will script the EXEC statement for you. Press F8 to open the
Object Browser, right-click on your proc, click "Script Object to new
window as" and then "EXECUTE". Result:
DECLARE @.RC int
DECLARE @.param1 int
DECLARE @.param2 varchar(10)
-- Set parameter values
EXEC @.RC = [JUNK].[dbo].[usp_proc_name] @.param1 OUTPUT , @.param2
>From the same point in the Object Browser you can also access the
debugger as JT suggested.
David Portas
SQL Server MVP
--|||declare @.x as int
If you want to print the result of an output parameter:
exec myproc @.a=1, @.b=2, @.c = @.x output
print @.x
If you want to print the result of a return value:
EXECUTE @.x = myproc @.a=1, @.b=2
print @.x
"Carlos" <cp@.swa.com> wrote in message
news:ufE8JxCyFHA.448@.TK2MSFTNGP11.phx.gbl...
> Ok I used the Query analyzer now where do I see my returned value ?
> "David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
> news:1128351195.556320.319300@.g49g2000cwa.googlegroups.com...
>|||Can you post a sample of what you are trying to test? It would be much
easier for us to determine what you exactly want to test.
----
Louis Davidson - http://spaces.msn.com/members/drsql/
SQL Server MVP
"Arguments are to be avoided: they are always vulgar and often convincing."
(Oscar Wilde)
"Carlos" <cp@.swa.com> wrote in message
news:ufE8JxCyFHA.448@.TK2MSFTNGP11.phx.gbl...
> Ok I used the Query analyzer now where do I see my returned value ?
> "David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
> news:1128351195.556320.319300@.g49g2000cwa.googlegroups.com...
>|||Hi Carlos,
Here are some articles for your reference about how to debug SQL Server
stored procedures and the necessary configuration settings and steps for
each approach
HOW TO: Debug Stored Procedures in Visual Studio .NET
http://support.microsoft.com/kb/316549/EN-US/
Troubleshooting tips for T-SQL Debugger in Visual Studio .NET
http://support.microsoft.com/kb/817178
Debugging Stored Procedures
http://www.windowsitpro.com/Article...6356/16356.html
You may also search keywords debug SQL stored procedure in google.com for
more
Thank you for your patience and cooperation. If you have any questions or
concerns, don't hesitate to let me know. We are always here to be of
assistance!
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
=============
This posting is provided "AS IS" with no warranties, and confers no rights.sql
No comments:
Post a Comment