I am getting following error
ERROR:- Incorrect syntax near '+'.
while executing following T-Sql
DECLARE @DatabasePath VARCHAR(MAX)
SET @DatabasePath = 'E:\ABC.xls'
INSERT INTO [dbo].[Table_1]
SELECT *
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database='+@DatabasePath+'',
'SELECT * FROM [Sheet1$]') AS xlsTable
Is there something wrong in T-Sql.
Actually i want to create a stored procedure where i will pass excel sheet path in @DatabasePath input parameter.
I dont thing this will work for you.
From OPENROWSET (Transact-SQL)
Have you tried something like