动态语句,bulkinsert的from子句只能使用常量. CREATEproctest @fnvarchar(50) as declare@pathvarchar(100) set@path='d:\' exec(' bulkINSERTtableFROM'''+@path+@fn+''' WITH ( FIELDTERMINATOR='','', ROWTERMINATOR=''\n'' )') 摘自CSDN
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