--查询与设备数据库自增ID
--DBCC CHECKIDENT (GoTone_Pay_per_view, NORESEED) --1547
--DBCC CHECKIDENT (GoTone_Pay_per_view, RESEED, 1547)
-----chinanetcomlog2006-08
-----[192.168.99.21].[chinanetcomlog2006-08]
Select * From sysobjects
where ID in(
Select ID From syscomments where text like '%EveryDayMms%')
order by name
Select *
From msdb.dbo.sysjobs
where job_id in(
Select job_id
From Msdb.dbo.sysjobsteps
where Command like '%P_ReportInitialize_Mms%'
)
------------------------------------------------------------------
2.在该数据库下可以通过以下脚本查询到有涉及该表的存储过程
Select * From sysobjects
where ID in(
Select ID From syscomments where text like '%TableName%')
3.通过作业名字跟踪存储过程位置。
Select *
From msdb.dbo.sysjobs
where job_id in(
Select job_id
From Msdb.dbo.sysjobsteps
where Command like '%P_ReportInitialize_Mms%'
)
sysjob开头的系统表都是跟作业相关的系统表,都在MSDB库下。
当前库下的几个系统表:
sysobjects 所有对象
syscolumns 表的列
--------------------------------------------------------------------------------
Select * From syscomments where text like '%EveryDayMms%'
Select * From sysobjects
where ID in(
Select ID From syscomments where text like '%EveryDayMms%')
Select *
From msdb.dbo.sysjobs
where job_id in(
Select job_id
From Msdb.dbo.sysjobsteps
where Command like '%P_ReportInitialize_Mms%'
)
------------------------------------------------------------------------------------
select day(dateadd(mm,1,convert(varchar(8),getdate()-1,120)+'01')-1) 当月的最后一天