Friday, February 17, 2012

Debug SQL User Functions

Does anyone know if there's a way to debug T-SQL user functions using sql
server 2000 sp3 on Windows Small Business Server 2003 from a client computer
running an Access 2003 mdb front-end on Windows XP SP2?
JayNot directly. You could debug the code if you create it as a procedure inste
ad.
ML|||ML,
I was afraid that would be the answer. The reason I wrote it as a function
is so that I could put it in a server-side query as in: "SELECT
MyFunc(SomeField, @.SomeInputVariable) AS SomeLabel FROM dbo.SomeTable;". Is
there a way to do the same thing with a procedure?
Jay
"ML" wrote:

> Not directly. You could debug the code if you create it as a procedure ins
tead.
>
> ML|||All you need in such a case is a sample of input parameters - for instance i
n
a table variable - and then you execute the code you intend to use in the
function with each set of parameters in a loop.
Or maybe you can post your DDL and get a 'second opinion'.
ML|||Try this out:
declare @.output2 varchar(30)
exec testbysandeep 1,2,@.output1=@.output2 OUTPUT
select @.output2
output1 is the field which is the output of the function. You assign this
value to the output2 variable.Then by doing a select statement you display
the value.
Hope this helps.
jains
"jay" wrote:
> ML,
> I was afraid that would be the answer. The reason I wrote it as a functi
on
> is so that I could put it in a server-side query as in: "SELECT
> MyFunc(SomeField, @.SomeInputVariable) AS SomeLabel FROM dbo.SomeTable;". I
s
> there a way to do the same thing with a procedure?
> Jay
> "ML" wrote:
>|||Hi Jay,
You can debug a UDF from QA by making a small SP that calls the UDF. The QA
debugger steps into the UDF with F11 the same as VS.
Cheers
Doug Forster
"jay" <jay@.discussions.microsoft.com> wrote in message
news:E2A1224F-03FA-4422-BD86-215675844400@.microsoft.com...
> ML,
> I was afraid that would be the answer. The reason I wrote it as a
> function
> is so that I could put it in a server-side query as in: "SELECT
> MyFunc(SomeField, @.SomeInputVariable) AS SomeLabel FROM dbo.SomeTable;".
> Is
> there a way to do the same thing with a procedure?
> Jay
> "ML" wrote:
>|||Hi Doug Forster,
Is there any kind of configuration setting involed at server side ?
With warm regards
Jatinder|||Well I do this ON the server with admin rights and it just works. Maybe
someone else knows if it is possible to debug from another box, though I
notice the docs caution against debugging on a production server.
Cheers
Doug Forster
"jsfromynr" <jatinder.singh@.clovertechnologies.com> wrote in message
news:1122878941.648594.17860@.g47g2000cwa.googlegroups.com...
> Hi Doug Forster,
> Is there any kind of configuration setting involed at server side ?
> With warm regards
> Jatinder
>|||Hi Forster ,
The problem is that it is not working (debuggin) even on Server .
It says that you are logged as 'Local Account' . Do I have to Logon the
service as administrator woul that effect other clients?
With warm regards
Jatinder Singh
Doug Forster wrote:
> Well I do this ON the server with admin rights and it just works. Maybe
> someone else knows if it is possible to debug from another box, though I
> notice the docs caution against debugging on a production server.
> Cheers
> Doug Forster
> "jsfromynr" <jatinder.singh@.clovertechnologies.com> wrote in message
> news:1122878941.648594.17860@.g47g2000cwa.googlegroups.com...|||Hi I just want to add what I am facing when trying to debug a procedure
(created on master DB using sa login)
when I start debugging on this procedure in query analyzer, I recieve a
msg box which says:
SP debugging may not work properly if you log on as 'Local System
account'
while SQL Server is configured to run as a service.
You can open Event Viwer to see details.
Do you want to continue?
When I continue with this and execute this procedure by providing
parameter values, I get the print outputs, but procedure execution
doesn't break on break points!!
I am puzzled now how to work around with this? How can I break
execution on break points?
Thanks

No comments:

Post a Comment