stacey14
asked on
debug stored procedure
Can you debug a stored procedure using SQL Server 7? If so, how. I don't see a debug feature on any menus but I thought I heard somewhere that you can.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Depends on exactly what you are looking for. I know some people like to know exactly where or at least narrow it down to a couple of lines. In that case use
Selsct *
select 10
FROM table_1
select 20
WHERE product_id = 2342346864
Select 30
Selsct *
select 10
FROM table_1
select 20
WHERE product_id = 2342346864
Select 30
This problem drove me crazy until i gave up and created a debug table. I use this code and repeat inserts as necessary.
a_JCC_rc is a four column table
prime-key
varchar
date
int
DECLARE @retrows int
DECLARE @DEBUGLOG int
DECLARE @TimeStamp datetime
set @TimeStamp = getdate() -- now
--set @DEBUGLOG = 0 -- for production
set @DEBUGLOG = 1 -- for test
set nocount on --To allow only last select to return rows from execution, using a cursor kills this attempt
if (@DEBUGLOG = 1) Truncate table a_JCC_rc --reset counters for new test
set @retrows = @@rowcount
if (@DEBUGLOG = 1) insert into a_JCC_rc values ('----------db ' + @DataBaseName, getdate(), @retrows )
-- Select statement in development
set @retrows = @@rowcount
if (@DEBUGLOG = 1) insert into a_JCC_rc values ('1- Select identifier ', @TimeStamp, @retrows )
if (@DEBUGLOG = 1) insert into a_JCC_rc (Returned_rows_label) select distinct UserLogin from #temp
select * from a_jcc_rc
a_JCC_rc is a four column table
prime-key
varchar
date
int
DECLARE @retrows int
DECLARE @DEBUGLOG int
DECLARE @TimeStamp datetime
set @TimeStamp = getdate() -- now
--set @DEBUGLOG = 0 -- for production
set @DEBUGLOG = 1 -- for test
set nocount on --To allow only last select to return rows from execution, using a cursor kills this attempt
if (@DEBUGLOG = 1) Truncate table a_JCC_rc --reset counters for new test
set @retrows = @@rowcount
if (@DEBUGLOG = 1) insert into a_JCC_rc values ('----------db ' + @DataBaseName, getdate(), @retrows )
-- Select statement in development
set @retrows = @@rowcount
if (@DEBUGLOG = 1) insert into a_JCC_rc values ('1- Select identifier ', @TimeStamp, @retrows )
if (@DEBUGLOG = 1) insert into a_JCC_rc (Returned_rows_label) select distinct UserLogin from #temp
select * from a_jcc_rc
Depends on exactly what you are looking for. I know some people like to know exactly where or at least narrow it down to a couple of lines. In that case use
Selsct *
select 10
FROM table_1
select 20
WHERE product_id = 2342346864
Select 30
Selsct *
select 10
FROM table_1
select 20
WHERE product_id = 2342346864
Select 30
Selsct *
select 10
FROM table_1
select 20
WHERE product_id = 2342346864
Select 30