我想用 SP 输入我的表名,以便它从 excel 表中导入数据并加载到数据库中。但是,收到以下错误。你能纠正一下吗?谢谢你。
create proc Up_Export
(
@Tablename as varchar(20) = null
)
AS
SET NOCOUNT ON
begin
INSERT INTO @Tablename --Receiving error over here, informs incorrect syntax near @tablename
SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C:\..\..\..\packages\@Tablename.xls', @Tablename)
set nocount off
end