动态语句, bulk insert的from 子句只能使用常量.
CREATE proc test
@fn varchar(50)
as
declare @path varchar(100)
set @path= ‘d:/’
exec(‘
bulk INSERT table FROM ”’+@path+@fn+”’
WITH
(
FIELDTERMINATOR = ”,”,
ROWTERMINATOR = ”/n”
)’)
摘自CSDN
原创文章,作者:carmelaweatherly,如若转载,请注明出处:https://blog.ytso.com/233446.html