Get Stored Procedure Using SQL

Not having backend access to a DotNetNuke website, or readily able to download a backup of the database.

My thoughts turned to how to review a stored procedure with SQL from the SQL host page in DotNetNuke.

SELECT
text
FROM
syscomments
WHERE
id = (SELECT id FROM sysobjects WHERE name = 'StoredProcedureName')
ORDER BY
colid

Given the following:

  • Name = Stored Procedure Name
  • Colid = Multiple lines, their sequence.
  • Replace StoredProcedureName with the name of the stored procdure of interest

For reference, in case you can’t remember the name of the stored procedure, and seeing them all might be sufficient to refresh your memory:

 SELECT
*
FROM
sysobjects
WHERE
type = 'P' AND category = 0
ORDER BY
name

Given the following:– Get Stored Procedures

  • Type = ‘P’ (Stored Procedure)
  • Category = 0 (User Created)