December 2001
Intermediate to advanced
800 pages
17h 55m
English
One technique for making an extended procedure a bit handier is to wrap it in a system procedure. This allows it to be easily called from any database context without having to be prefixed with master.. A good number of SQL Server's own extended procedures are wrapped in system stored procedures. Here's an example using the undocumented routine xp_varbintohexstr (Listing 20-15):
USE master IF (OBJECT_ID('dbo.sp_hexstring') IS NOT NULL) DROP PROC dbo.sp_hexstring GO CREATE PROC dbo.sp_hexstring @int varchar(10)=NULL, @hexstring varchar(30)=NULL OUT /* Object: sp_hexstring Description: Return an integer as a hexadecimal string Usage: ... |
Read now
Unlock full access