I want to pass a a table name as parameter in a stored procedure to allow it to chioose its table, but it doesnt work. i`ve tried the following:-
CREATE PROCEDURE testTables
@tableName varchar (50),
@name_New varchar(50)
AS
INSERT INTO [@tableName]
VALUES
(@name_New)
testTables 'TESTING','myName'
'TESTING' is the table name and 'myName' is a value to be inserted in the table TESTING
CREATE PROCEDURE testTables
@tableName varchar (50),
@name_New varchar(50)
AS
INSERT INTO [@tableName]
VALUES
(@name_New)
testTables 'TESTING','myName'
'TESTING' is the table name and 'myName' is a value to be inserted in the table TESTING