IT Community - Software Programming, Web Development and Technical Support

SQL Server Undocumented Stored Procedures

This is a discussion on SQL Server Undocumented Stored Procedures within the Database Support forums, part of the Web Development category; Hi all, In this Thread, I want to tell you about some useful undocumented stored procedures shipped with SQL Server. ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > Database Support

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 09-04-2007, 03:25 AM
a.deeban a.deeban is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 279
a.deeban is on a distinguished road
Default SQL Server Undocumented Stored Procedures

Hi all,

In this Thread, I want to tell you about some useful undocumented stored procedures shipped with SQL Server.


thnx...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 09-04-2007, 03:28 AM
a.deeban a.deeban is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 279
a.deeban is on a distinguished road
Default stored procedure used to get the qualified name for the given object id

Hi,

sp_MSget_qualified_name

This stored procedure is used to get the qualified name for the given object id.

Syntax
sp_MSget_qualified_name object_id, qualified_name

where

object_id - is the object id. object_id is int.

qualified_name - is the qualified name of the object. qualified_name is nvarchar(512).

This is an example to get the qualified name for the authors table from the pubs database.
USE pubs

GO

DECLARE @object_id int, @qualified_name nvarchar(512)

SELECT @object_id = object_id('authors')

EXEC sp_MSget_qualified_name @object_id, @qualified_name OUTPUT

SELECT @qualified_name

GO

Here is the result set from my machine:
--------------------------------------

[dbo].[authors]

thnx..
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 09-04-2007, 03:29 AM
a.deeban a.deeban is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 279
a.deeban is on a distinguished road
Default stored procedure is used to drop an object : sp_MSdrop_object

Hi,

sp_MSdrop_object

This stored procedure is used to drop an object (it can be table, view, stored procedure or trigger) for the given object id, object name, and object owner. If object id is provided, then the object name and the object owner need not be specified.

Syntax
sp_MSdrop_object [object_id] [,object_name] [,object_owner]

where

object_id - is the object id. object_id is int, with a default of NULL.

object_name - is the name of the object. object_name is sysname, with a default of NULL.

object_owner - is the object owner. object_owner is sysname, with a default of NULL.

This is the example of dropping the titleauthor table from the pubs database.
USE pubs

GO

DECLARE @object_id int

SELECT @object_id = object_id('titleauthor')

EXEC sp_MSdrop_object @object_id

GO



thnx...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 09-04-2007, 03:31 AM
a.deeban a.deeban is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 279
a.deeban is on a distinguished road
Default stored procedure returns the type of string for the given table id and column id :

Hi,

sp_gettypestring

This stored procedure returns the type of string for the given table id and column id.

Syntax
sp_gettypestring tabid, colid, typestring

where

tabid - is the table id. tabid is int.

colid - is the column id. colid is int.

typestring - is the type string. It's an output parameter. typestring is nvarchar(255)

This is the example to get the type string for the column number 2 in the authors table, from the pubs database.
USE pubs

GO

DECLARE @tabid int, @typestring nvarchar(255)

SELECT @tabid = object_id('authors')

EXEC sp_gettypestring @tabid, 2, @typestring output

SELECT @typestring

GO

Here is the result set from my machine:
-------------------------------

varchar(40)


thnx...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Performance Tuning Tips About Sql Server Stored Procedures vadivelanshanmugam Database Support 0 02-04-2008 06:16 AM
Performance Tuning Tips About Sql Server Stored Procedures vadivelanshanmugam Database Support 0 02-04-2008 06:14 AM
Some Performance tuning tips about SQL Server Stored Procedures vadivelanshanmugam Database Support 0 02-04-2008 06:12 AM
SQL Server Undocumented Stored Procedures a.deeban Database Support 2 12-23-2007 11:20 PM
Executing SQL Server Stored Procedures With PHP - Executing stored procedures Jeyaseelansarc PHP Programming 1 07-19-2007 12:23 AM


All times are GMT -7. The time now is 07:05 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0