select all row in table from name table is Nvarchar (SQL- SERVER)

Thursday, July 10, 2014

I will create procedure by sql query and have @name_table (nvarchar). How do one procedure using for multiple table not use "EXCE" example:

CREATE TABLE tbl_produces ( id int primary key, name nvarchar(250), )

GO INSERT INTO tbl_produces VALUES (1,'abc'),(2,'cde'),(3,'hfd')

GO CREATE PROCEDURE return_table ( @table_name nvarchar(250) ) AS SELECT * FROM @table_name


GO " EXCE return_table 'tbl_produces' " = " SELECT * FROM tbl_produces "

How do i can use that? Help me ! Thank for help