sp debug

[b]sp debug method[/b]
create table SPOptimizationTb (
spName varchar(100) not null ,
seq int not null ,
breakpoint int not null ,
consume int not null ,
remark varchar(200) null ,
createDate datetime null
)
lock allpages
on 'default'
go

declare @dbLog bit
declare @breakpoint int
declare @spName varchar(100)
declare @seq int
declare @remark varchar(200)
declare @consume int
declare @logTime datetime

select @dbLog = 0
select @breakpoint = 0 -- breakpoint increase from 1
select @spName = 'SelCommentaryList'

declare @runTime datetime
declare @temTime varchar(200)
set @runTime = getDate()
select @runTime

select @seq = max(seq)+1 from SPOptimizationTb where spName = @spName
if @seq = null
begin
select @seq = 1
end

declare @catIds varchar(16384)
declare @sites varchar(50)
declare @regionCode char(30)
declare @theme int
declare @frDate datetime
declare @toDate datetime
declare @totalRows int
declare @tags varchar(16384)
declare @excludetags varchar(16384)
declare @keyValue varchar(16384)

set @catIds = '|KK%|KM%|'
set @sites = 'GEOEXT'
set @regionCode = 'ALL'
set @theme = -1
set @frDate = '04/20/2011'
set @toDate = '07/19/2011'
set @totalRows = 0
set @tags = ' '
set @excludetags = '|CONTENT_CATEGORY:CC_008|'
set @keyValue = 'EMERGINGMKTS_OVERVIEW_ALL'

-- ************************ record time begin *****************************
select @logTime = getDate()
select @remark = '----#step 1, if else : '
select @consume = datediff(ms,@runTime,@logTime)
select @temTime = convert(varchar(200), @consume)
select @breakpoint = @breakpoint + 1
if @dbLog = 1
insert into SPOptimizationTb values(@spName, @seq, @breakpoint, @consume, @remark, @logTime)

print @remark
print @temTime
select @runTime = getDate()
-- ************************ record time end *****************************
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值