baskaran chellasamy

baskaran chellasamy

  • NA
  • 114
  • 150.6k

Error in store procedure

Aug 23 2012 11:24 PM
Hi friends
 The below is my stored procedure
create  procedure sp_excelforgeneralholiday
 as 
 declare @sql varchar(500)
 set nocount on
  begin
  Set @sql =select * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
  'Excel 8.0;Database=D:\baskarbook1.xls;HDR=YES;',
  'SELECT * FROM [Sheet1$]')
  exec (@sql)
 end

The error is
Msg 156, Level 15, State 1, Procedure sp_excelforgeneralholiday, Line 11
Incorrect syntax near the keyword 'select'.

I dont which syntax error in my query.please help me


Answers (3)