Link to home
Start Free TrialLog in
Avatar of zimmer9
zimmer9Flag for United States of America

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_ImportMonthlyChecksEntity (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_ImportMonthlyChecks 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),not null)
importedby(varchar(50),not null)
branch(varchar(50),null)
ASKER CERTIFIED SOLUTION
Avatar of Vitor Montalvão
Vitor Montalvão
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial