Click here to Skip to main content
15,906,463 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Greetings everyone,

I’m working on a managment tool. This is wrote in C# and using a MS SQL Server database with some stored procedures.

I need to list them in my tool to check with a list of new procedures if I have to create or update procedures.

Some one can give me a clue ?

What I have tried:

I already try to use a sql statment using sys.object but when I try in C# I got Sql exception.
Posted
Updated 5-May-17 0:42am
Comments
F-ES Sitecore 5-May-17 6:18am    
google "c# list all stored procedures" and you'll find lots of examples. If you have code that is giving an error then show the code, the error and the line you get the error on. We can't help with zero information.

Just read the output of SYS.PROCEDURES.

This will give you all your procedures and info you need:

Select * from sys.procedures


If this give you a exception put it down in the comment.
Why are you not using delete if exist and create?
Just delete all procedures and insert is also possible and easier.
 
Share this answer
 
v2
You can fetch list of SP by
select * from sys.procedures

You can order it by modify date to get latest updated stored procedure list
select * from sys.procedures order by modify_date desc

You can sort SP list by new created also
select * from sys.procedures order by created_on desc

Let me know if you have any query or concern for same.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900