Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. problem with stored procedure

problem with stored procedure

Scheduled Pinned Locked Moved Database
databasehelpcomtutorial
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    suhailahmedmohammed
    wrote on last edited by
    #1

    Hi, i want to write stored procedure insuch a way where in it has to return the table name used stored procedure. for example create procedure proc1 as begin select * from student end once u exit exec proc1 it has return the table name used i.e "Student" could you please help in doing this. or it is possible in sql. reply me soon at suhailquadri@gmail.com:-D Suhail Ahmed Mohammed, Application Engineer, Cybernet Slash Support

    P M S 3 Replies Last reply
    0
    • S suhailahmedmohammed

      Hi, i want to write stored procedure insuch a way where in it has to return the table name used stored procedure. for example create procedure proc1 as begin select * from student end once u exit exec proc1 it has return the table name used i.e "Student" could you please help in doing this. or it is possible in sql. reply me soon at suhailquadri@gmail.com:-D Suhail Ahmed Mohammed, Application Engineer, Cybernet Slash Support

      P Offline
      P Offline
      pmarfleet
      wrote on last edited by
      #2

      I don't think there is any way to do this. Besides, is it necessary? Stored procedure are usually coded to select data from a particular table or tables. You would know which table(s) each stored procedure used, so you could use an OUTPUT parameter to return a varchar value which was hard-coded to that table name for each stored procedure.

      Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush

      S 1 Reply Last reply
      0
      • S suhailahmedmohammed

        Hi, i want to write stored procedure insuch a way where in it has to return the table name used stored procedure. for example create procedure proc1 as begin select * from student end once u exit exec proc1 it has return the table name used i.e "Student" could you please help in doing this. or it is possible in sql. reply me soon at suhailquadri@gmail.com:-D Suhail Ahmed Mohammed, Application Engineer, Cybernet Slash Support

        M Offline
        M Offline
        Michael Potter
        wrote on last edited by
        #3

        This returns the query plus a table with 1 row - 1 column that contains the table name. Seems like a waste of time since the developer already knows the table name.

        CREATE PROCEURE proc1
        AS
            SELECT
                *
            FROM
                student
            
            SELECT 
                'student'
        
        P 1 Reply Last reply
        0
        • S suhailahmedmohammed

          Hi, i want to write stored procedure insuch a way where in it has to return the table name used stored procedure. for example create procedure proc1 as begin select * from student end once u exit exec proc1 it has return the table name used i.e "Student" could you please help in doing this. or it is possible in sql. reply me soon at suhailquadri@gmail.com:-D Suhail Ahmed Mohammed, Application Engineer, Cybernet Slash Support

          S Offline
          S Offline
          suhailahmedmohammed
          wrote on last edited by
          #4

          Thanks i got the solution.

          1 Reply Last reply
          0
          • P pmarfleet

            I don't think there is any way to do this. Besides, is it necessary? Stored procedure are usually coded to select data from a particular table or tables. You would know which table(s) each stored procedure used, so you could use an OUTPUT parameter to return a varchar value which was hard-coded to that table name for each stored procedure.

            Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush

            S Offline
            S Offline
            suhailahmedmohammed
            wrote on last edited by
            #5

            well using sp_depends storedprocedurename , it will list all the details of a stored procedure.

            1 Reply Last reply
            0
            • M Michael Potter

              This returns the query plus a table with 1 row - 1 column that contains the table name. Seems like a waste of time since the developer already knows the table name.

              CREATE PROCEURE proc1
              AS
                  SELECT
                      *
                  FROM
                      student
                  
                  SELECT 
                      'student'
              
              P Offline
              P Offline
              Paul Conrad
              wrote on last edited by
              #6

              Michael Potter wrote:

              Seems like a waste of time since the developer already knows the table name.

              It is.

              "Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus

              S 1 Reply Last reply
              0
              • P Paul Conrad

                Michael Potter wrote:

                Seems like a waste of time since the developer already knows the table name.

                It is.

                "Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus

                S Offline
                S Offline
                suhailahmedmohammed
                wrote on last edited by
                #7

                you need to access the information about stored procedure dependencies written by another dba. I m displaying the information of stored procedure dependencies using sp_depends procedurename. It was requested by one of my client. Now programmetically i dispalyed in table and displayed accordingly.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups