Friday, August 16, 2013

A sample code to import XLS file to SQL as a table


set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[LOAD_MAIL_DATA]
AS
TRUNCATE TABLE TB_MAIL_TRACE
insert into TB_MAIL_TRACE select * from
OPENROWSET('MICROSOFT.JET.OLEDB.4.0'
,'Excel 5.0;HDR=YES;DATABASE=C:\Mail_Trace\Mail_Trace.xls',sheet1$)


No comments:

Post a Comment