zimmer9
asked on
Why do I get an error when executing a stored procedure using SQL Server 2008?
I am using Microsoft SQL Server 2008
I tried using the following stored procedure but when I execute it, I get an error as follows:
Msg 156, Level 15, State 1, Line 4
Incorrect syntax near the keyword 'SELECT'.
Msg 102, Level 15, State 1, Line 13
Incorrect syntax near ')'.
INSERT INTO dbo.tbl_CSL_ImportMonthlyC hecksEntit y (bankname, branch, banknumber, amt1,
amt2, datefile, dateimported, importedby)
values
(SELECT
CSLIC.bankname,
CSLIC.branch,
CSLIC.banknumber,
CSLIC.amt1,
CSLIC.amt2,
CSLIC.datefile,
CSLIC.dateimported,
CSLIC.importedby
from dbo.tbl_CSL_ImportMonthlyC hecks AS CSLIC);
Both tables have the same data types as follows:
bankname (varchar(50), null)
banknumber(varchar(4),not null)
amt1(varchar(11),not null)
amt2(numeric(19,2),not null)
datefile(varchar(10),not null)
dateimported(varchar(10),n ot null)
importedby(varchar(50),not null)
branch(varchar(50),null)
I tried using the following stored procedure but when I execute it, I get an error as follows:
Msg 156, Level 15, State 1, Line 4
Incorrect syntax near the keyword 'SELECT'.
Msg 102, Level 15, State 1, Line 13
Incorrect syntax near ')'.
INSERT INTO dbo.tbl_CSL_ImportMonthlyC
amt2, datefile, dateimported, importedby)
values
(SELECT
CSLIC.bankname,
CSLIC.branch,
CSLIC.banknumber,
CSLIC.amt1,
CSLIC.amt2,
CSLIC.datefile,
CSLIC.dateimported,
CSLIC.importedby
from dbo.tbl_CSL_ImportMonthlyC
Both tables have the same data types as follows:
bankname (varchar(50), null)
banknumber(varchar(4),not null)
amt1(varchar(11),not null)
amt2(numeric(19,2),not null)
datefile(varchar(10),not null)
dateimported(varchar(10),n
importedby(varchar(50),not
branch(varchar(50),null)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.