| Author |
Topic |
|
reddymade
Posting Yak Master
165 Posts |
Posted - 2005-06-10 : 15:45:51
|
| Is it possible to get the list of all the stored procedure names available in a database.Please i need to get a print out of it to do some checking.I am using sql server 2000/And my database name is myprojectPlease let me know, Thank you very much for the information. |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2005-06-10 : 15:50:31
|
| here's one way:select name from sysObjects where type = 'P' order by nameBe One with the OptimizerTGEDIT:I'm trying to stop using the system tables so here's a (newer) way:select routine_name from information_schema.routines where routine_type = 'procedure' order by routine_name |
 |
|
|
nathans
Aged Yak Warrior
938 Posts |
Posted - 2005-06-10 : 18:57:03
|
Another way:select so.namefrom sysobjects sowhere objectproperty(so.id, N'IsProcedure') = 1order by so.name TG: Would you look at the objectProperty as just a coding shortcut, is it good/bad practice to utilize them? |
 |
|
|
DBASlut
Yak Posting Veteran
71 Posts |
Posted - 2005-06-10 : 19:17:33
|
| nathans, i wouldn't look at the objectProperty as a bad practice, similar to getting the approximate record count from the sys tables instead of going directly to the table itself..:) |
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2005-06-10 : 19:20:58
|
Here is one I wrote that uses objectproperty to join a system table to an INFORMATION_SCHEMA view in order to look at the column descriptions stored in extended properties.And, yes I know about the fn_listextendedproperty function.select a.[TABLE_SCHEMA], a.[TABLE_NAME], a.[ORDINAL_POSITION], b.[VALUE]from [INFORMATION_SCHEMA].[COLUMNS] a inner join [dbo].[sysproperties] b on a.[TABLE_SCHEMA] = user_name(objectproperty(b.[id],'OwnerId')) and a.[TABLE_NAME] = object_name(b.[id]) and a.[ORDINAL_POSITION] = b.[smallid]where b.[TYPE] = 4 and a.[TABLE_SCHEMA] = 'dbo' and a.[TABLE_NAME] = 'T_FOO'order by a.[TABLE_SCHEMA], a.[TABLE_NAME], a.[ORDINAL_POSITION] quote: Originally posted by nathansTG: Would you look at the objectProperty as just a coding shortcut, is it good/bad practice to utilize them?
CODO ERGO SUM |
 |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2005-06-11 : 10:08:39
|
| >>TG: Would you look at the objectProperty as just a coding shortcut, is it good/bad practice to utilize them?Not a bad practice at all. In fact, Sql Server may very well change usage, limit access, or remove entirely system tables/columns in the future. But their own functions like objectproperty should continue to return accuate results. (even if they change the way it works under the sheets)Be One with the OptimizerTG |
 |
|
|
vivek.kumargupta
Starting Member
45 Posts |
Posted - 2005-06-13 : 03:24:04
|
| SELECT DISTINCT nameFROM sysobjectsWHERE (xtype = 'p')is also the soln!!!Thanks, Vivek |
 |
|
|
vivek.kumargupta
Starting Member
45 Posts |
Posted - 2005-06-13 : 03:24:37
|
| why the fuss abt this ?? can anyone explain !!!Thanks, Vivek |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2005-06-13 : 08:26:53
|
| The fuss is that accessing system tables can cause broken code between versions. Several system tables changed from SQL 7.0 and 2000, and in 2005, ALL of the system tables are going to change. If you have a solution that uses INFORMATION_SCHEMA views or Property() functions, you avoid the potential for broken code. |
 |
|
|
vivek.kumargupta
Starting Member
45 Posts |
Posted - 2005-06-13 : 09:00:27
|
| OK, thanks for the valuable i/pThanks, Vivek |
 |
|
|
|