Hi friends
this is my store procedure for getting external excel file and save into sql database.
create procedure sp_excelforgeneralholidays(@filname nvarchar(max))
as
set nocount on
begin
select * from OPENROWSET('Microsoft.jet.OLEDB.4.0','Excel 8.0;DATABASE=' + @filname + ', Select Date,Day,Reason from [sheet1$])'
end
When i Run this error is near syntax error + . but i dont know how to solve this problem please help me
Loading
Akkiraju IvaturiPosted Aug 22, 2012, 8:25 PM
http://www.kodyaz.com/articles/enable-Ad-Hoc-Distributed-Queries.aspx
baskaran chellasamyPosted Aug 22, 2012, 5:24 PM
Javeed M ShaikhPosted Aug 22, 2012, 5:19 PM
baskaran chellasamyPosted Aug 22, 2012, 5:15 PM
Akkiraju IvaturiPosted Aug 22, 2012, 4:35 PM
replace select statement with the following:
exec('select * from OPENROWSET(''Microsoft.jet.OLEDB.4.0'',''Excel 8.0;Database='+@filename+',select date, day,reason from [sheet1$])')
Javeed M ShaikhPosted Aug 22, 2012, 4:26 PM
try this.
create procedure sp_excelforgeneralholidays(@filname nvarchar(max))