I have a table Persons
(Id, Name
), and I need to create a table with name Results_NameUser
(where NameUser
is the name of the user). This table is automatically generated after I create a user on my Form. I need use a stored procedure for this operation, but I don't know how to write this.
I have preliminarily code of a procedure (this procedure will called in code after create user)
CREATE PROCEDURE createResult
@userName VARCHAR(50)
AS
BEGIN
CREATE TABLE Result_@userName
(
resultId UNIQUEIDENTIFIER NOT NULL,
scores INT
);
END
But the code is not correct. Please, tell me, how create this procedure