避免命名用户存储过程 SP% 或 SP_% [英] Avoid Naming User Stored Procedures SP% or SP_%

查看:51
本文介绍了避免命名用户存储过程 SP% 或 SP_%的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

前缀为 SP(而不是 SP_)的用户存储过程是否通过查看 Master DB(类似于名为 SP_ 的用户 SP)而导致性能较差,或者它是否在存储过程所在的 DB 中查找,因为它缺少下划线?

Does a user stored procedure with the prefix of SP (not SP_) have poorer performance by looking in the Master DB (similar to user SP named SP_) or does it look in the DB where the stored procedure exists because it lack an underscore?

推荐答案

保留前缀 表现出这种行为的是sp_.不是 sp.

The reserved prefix that exhibits this behaviour is sp_. Not sp.

一个名为 spAddUser 的存储过程将以正常方式解析,无需在 master 中寻找匹配的对象.

A stored procedure called spAddUser will be resolved in the normal way without looking for a matching object in master.

相关的在线书籍引用

在命名过程时避免使用 sp_ 前缀.这个前缀是SQL Server 使用它来指定系统过程.使用前缀如果有系统过程,可能会导致应用程序代码中断同名.

Avoid the use of the sp_ prefix when naming procedures. This prefix is used by SQL Server to designate system procedures. Using the prefix can cause application code to break if there is a system procedure with the same name.

但无论如何我都会避免使用这些前缀.如果所有存储过程都以 sp 为前缀,IMO 很快就会变得烦人.

But I would avoid these prefixes anyway. If all the stored procedures are prefixed sp it quickly gets annoying IMO.

这篇关于避免命名用户存储过程 SP% 或 SP_%的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆