Answer the question
In order to leave comments, you need to log in
How to create a stored procedure where the parameter will be the table name?
I'm trying to create a stored procedure in which the name of the created table is set as a parameter. Tried initially like this (because the name is a unique number):
CREATE PROCEDURE createTableFact
(
@name int
)
AS
CREATE TABLE @name (id int not null IDENTITY (1,1), products varchar(max), weight int, boxes int, suma int, total int)
CREATE PROCEDURE createTableFact
(
@name varchar(max)
)
AS
CREATE TABLE @name (id int not null IDENTITY (1,1), products varchar(max), weight int, boxes int, suma int, total int)
cmd.CommandText = "CREATE TABLE "+affected+" (id int not null IDENTITY (1,1), products varchar(max), weight int, boxes int, suma int, total int)";
Answer the question
In order to leave comments, you need to log in
The idea smacks of insanity, so I want to learn more about the idea and business logic, why all this. And there is a
solution
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question