1

I am trying to display T-SQL of stored procedure in my delphi application.

I have no idea whether it is possible using ADO or Firedac components. I am able to get list of stored procedures using firedac but not sql.

Need to be pointed to the right direction so that i can add this feature in my application.

Khawar
  • 33
  • 1
  • 6
  • 1
    There's no native FireDAC API way. Use one of the [suggested T-SQL ways](https://learn.microsoft.com/en-us/sql/relational-databases/stored-procedures/view-the-definition-of-a-stored-procedure). – Victoria May 01 '18 at 08:57
  • 1
    In addition to what @Victoria said, you might take a look at this SO q:https://stackoverflow.com/questions/467482/programmatically-retrieve-sql-server-stored-procedure-source-that-is-identical-t – MartynA May 01 '18 at 09:45
  • 1
    The sys.* views contain object information including source in `sys.sql_modules` and a list of procedures in `sys.procedures`. – Brian May 01 '18 at 12:51
  • Why are you showing the contents of your stored procedures in an application? Most of the time this is a very bad idea. – Sean Lange May 01 '18 at 14:29
  • @Sean, very bad idea in what exactly? I would say, if you want to show DDL in your application, you have a reason. For the rest are user rights. If somebody fails at managing them is administrator's responsability. – Victoria May 01 '18 at 21:38
  • @Victoria if a user has the technical knowledge that displaying the code for a stored procedure makes sense to them why not let them just have access to the server? And as I said, most of the time. – Sean Lange May 02 '18 at 13:28
  • DDL of procedure is to be shown to a specific user not for all user to give him/her some idea what tables functions are used behind. We cannot give direct access to server only a few tables access is given and access to stored procedures cannot be given as user can modify them accidently – Khawar Jun 30 '18 at 11:37

0 Answers0