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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Send table name to a stored procedure

Send table name to a stored procedure

Scheduled Pinned Locked Moved Database
databasehelpquestion
2 Posts 1 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.
  • Y Offline
    Y Offline
    Yevgeny Efter
    wrote on last edited by
    #1

    Hello! I am writing a stored procedure that should insert a row in a table that it's name is sent to it as a parameter. I do it this way: CREATE PROCEDURE myProcedure @tablename ntext, AS INSERT INTO @tablename(...) and I get an error "Must declare the table variable "@tablename"". What should I do? Thanks in advance!

    Have a nice day!

    Y 1 Reply Last reply
    0
    • Y Yevgeny Efter

      Hello! I am writing a stored procedure that should insert a row in a table that it's name is sent to it as a parameter. I do it this way: CREATE PROCEDURE myProcedure @tablename ntext, AS INSERT INTO @tablename(...) and I get an error "Must declare the table variable "@tablename"". What should I do? Thanks in advance!

      Have a nice day!

      Y Offline
      Y Offline
      Yevgeny Efter
      wrote on last edited by
      #2

      Solved the problem. I'm using EXEC instead of an explicit INSERT.

      Have a nice day!

      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