BULK INSERT PROCEDURE

--以下存储过程是处理大批数据从文件插入表的
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

CREATE PROCEDURE [dbo].[ps_Deact_Phonenumber_Import]
@FileName varchar(100)
AS

--Build sql
DECLARE @SQL varchar(2000)
SET @SQL = "BULK INSERT DEACT_PHONENUMBER FROM '"+@FileName+"' WITH (ROWTERMINATOR = '"+char(10)+"',ROWS_PER_BATCH=100000) "

--clean the data
truncate table DEACT_PHONENUMBER

--Execute BULK INSERT statement
EXEC (@SQL)

你可能感兴趣的:(sql,Go)