I'm new to T-Sql, but intermediate in MS Access. Below I have a section of code I've been trying to get to work in the Query Analyzer. In Access you can make up 2 variables assign values to them, and use those variables as the name of your table and field, append to the TableDefs collection. First I tried something simple, before the "create procedure" method, and that was just to declare a @variable, assign a value to it @variable = "MyTable" then write "CREATE TABLE"... then @variable. I thought the result would have been a table created named "MyTable". Instead I received an error similar to the one i'm getting on the T-Sql code below. Is this even possible to execute???
--I receive the following error
--on the code below... "Line 4: Incorrect syntax near '@tblName'."
CREATE PROCEDURE MkeTable
@tblName varchar(50)
AS
create table @tblName
(
Field varchar(50)
)
--I receive the following error
--on the code below... "Line 4: Incorrect syntax near '@tblName'."
CREATE PROCEDURE MkeTable
@tblName varchar(50)
AS
create table @tblName
(
Field varchar(50)
)