lifesupport
Programmer
I get the following error when I run the stored procedure below. I can't see what is wrong. It's a simple select statement into a paramaterized table. Thanks
When running, it asks me to feed in a variable so I type Selstate123
Error Msg:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '.'.
********************
Stored Procedure Code:
ALTER PROCEDURE [dbo].[SP_MakeSelStateParam]
@tablename varchar(50)
AS
BEGIN
from
SET NOCOUNT ON;
Declare @SQL VarChar(1000)
select @SQL = 'select statecode, statename, statenum, nstatenum, selection'
select @SQL = @SQL + 'into dbo.' + @tablename
select @SQL = @SQL + 'from state'
exec (@SQL)
END
When running, it asks me to feed in a variable so I type Selstate123
Error Msg:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '.'.
********************
Stored Procedure Code:
ALTER PROCEDURE [dbo].[SP_MakeSelStateParam]
@tablename varchar(50)
AS
BEGIN
from
SET NOCOUNT ON;
Declare @SQL VarChar(1000)
select @SQL = 'select statecode, statename, statenum, nstatenum, selection'
select @SQL = @SQL + 'into dbo.' + @tablename
select @SQL = @SQL + 'from state'
exec (@SQL)
END