`

看你知道不知道之-用好sp_depends

 
阅读更多

前几天检查一个兄弟写的存储过程,我想知道这个存储过程到底涉及到几个表,与我要求的表是否一致,是否有缺失,怎么办呢?难道靠人的眼睛一点一点看吗?这个到不麻烦?但是如果想知道都有那些表被读写过,哪些表被写过。。。。这不是很麻烦吗?有没有好的办法呢?

答案:使用sp_depends。

MSDN内容:

sp_depends
显示有关数据库对象相关性的信息(例如,依赖表或视图的视图和过程,以及视图或过程所依赖的表和视图)。不报告对当前数据库以外对象的引用。

语法
sp_depends [ @objname = ] 'object'

参数
[@objname =] 'object'

被检查相关性的数据库对象。对象可以是表、视图、存储过程或触发器。Object 的数据类型为 varchar(776),没有默认值。

返回代码值
0(成功)或 1(失败)

结论:使用sp_depends,结合编码,可以实现自动的存储过程依赖关系检查,扩展后就可以实现存储过程的自动测试。

分享到:
评论

相关推荐

    php.ini-development

    ;;;;;;;;... 1.... 2.... 3.... 4.... 5.... 6.... The syntax of the file is extremely simple.... Section headers (e.g.... at runtime.... There is no name validation.... (e.g.... previously set variable or directive (e.g....

    sybase数据库存储过程编写经验以及方法

    开发人员如果用到其他库的Table或View,务必在当前库中建立View来实现跨库操作,最好不要直接使用“databse.dbo.table_name”,因为sp_depends不能显示出该SP所使用的跨库table或view,不方便校验。 提交SP前,必须...

    SQL sever 实训

    --对销售表ProOut的SaleDate 列进行约束,当不输入值时,系统默认其值为系统当前日期 CREATE DEFAULT Today AS GETDATEA() GO /*ALTER TABLE ProOut ADD CONSTRAINT DF_ProOut_SaleDate DEFAULT('当前日期')FOR ...

    svm matlab版本

    from .dll to .mexw32 or .mexw64 (depends on 32-bit or 64-bit Windows). If your MATLAB is older than 7.1, you have to build these files yourself. Example: matlab> mex -setup (ps: MATLAB will show ...

    NIST SP800-41.pdf

    The type of firewall to use depends on several factors, including the size of the site, the amount of traffic, the sensitivity of systems and data, and the applications required by the organization....

    windows10_python3.7下安装jax用的jax0.2.9和jaxlib0.1.61

    windows10_python3.7下安装jax用的jax0.2.9和jaxlib0.1.61

    NIST SP800-57pt1r4.pdf

    Ultimately, the security of information protected by cryptography directly depends on the strength of the keys, the effectiveness of the mechanisms and protocols associated with the keys, and the ...

    flutter_windows_1.22.5-stable

    不明白,开源的东西,为什么分享一下还要收别人的积分? To install and run Flutter, your development environment must meet these minimum requirements: Operating Systems: Windows 7 SP1 or later (64-bit),...

    联想旭日420AXP系统芯片组驱动

    ************************************************************ * Product: Intel(R) Chipset Software Installation Utility * Release: Production * Version: 7.2.2.1006 * Target Chipset(s)#: 955X/XM/975X/...

    DeZender.DeIoncuber.29.11.2011

    #5: Take a look in _decoded_nws or _decoded_rm (depends on the dezender used) ========= Thanks to ========= sidxx55 ps2gamer =============================== Visit us at http://deioncube.in Sudu's ...

    微软内部资料-SQL性能优化2

    Contents Module Overview 1 Lesson 1: Memory 3 Lesson 2: I/O 73 Lesson 3: CPU 111 Module 3: Troubleshooting Server Performance ...Troubleshooting server performance-based support calls requires ...

    ighashgpu破解程序

    Speed depends on GPU, ATI HD5870: ~2400M/s single MD5 ~795M/s single SHA1 ATI HD4850: ~980M/s single MD5 ~720M/s batch of MD5s (down to ~420M for 400K hashes) ~305M/s single SHA1 nVidia GTX260 w/ ...

Global site tag (gtag.js) - Google Analytics