Strangenut

Query to get the parameter list along with datatypes and maxlength for SQL 2005

Today we had a need for a query that would return information on a stored procedure and give us a list of parameters, datatypes, and max values.  This functionality is built into the data adapter but we wanted a little bit more flexibility on how we used the data that was returned.  Here is what we came up with:

 

SELECT sysobjects.name AS table_name, syscolumns.name AS column_name, systypes.name AS datatype, syscolumns.LENGTH AS LENGTH

  FROM  sysobjects

 INNER JOIN  syscolumns ON sysobjects.id = syscolumns.id

 INNER JOIN  systypes ON syscolumns.xtype = systypes.xtype

 WHERE (sysobjects.xtype = 'P')

   and sysobjects.name = 'spProcedureName'

 ORDER BY sysobjects.name

 

 

 


Posted Apr 10 2008, 03:24 PM by dacrowlah
Powered by Community Server (Non-Commercial Edition), by Telligent Systems