Hi all,
I was wondering how I could create a new table in SQL using a stored procedure. I have a program that needs to create a new table based on a number so for instance I would like to have TableName be a variable which I could enter Table_123 as the name. My problem is that, I can not get this to execute when I try to make it a procedure. What am I doing wrong?
Also, completely separate from this, I have to delete tables that have not been modified in 14 days. What is the best way to accomplish this?
-Thanks
Bill
I was wondering how I could create a new table in SQL using a stored procedure. I have a program that needs to create a new table based on a number so for instance I would like to have TableName be a variable which I could enter Table_123 as the name. My problem is that, I can not get this to execute when I try to make it a procedure. What am I doing wrong?
Code:
CREATE TABLE TableName
(CartonID nvarchar(50),
DCIC nvarchar(50),
DoorNum nvarchar(50),
TruckNum nvarchar(50),
SealNum nvarchar(50),
SimpleTime timestamp,
SimpleDate nvarchar(50),
SortDateTime smalldatetime,
Operator nvarchar(50))
Also, completely separate from this, I have to delete tables that have not been modified in 14 days. What is the best way to accomplish this?
-Thanks
Bill