Import Excel with Openrowset




 
if object_id('[aNewTable20150729]') IS NULL

Begin
CREATE TABLE [dbo].[aNewTable20150729](
	[accountnumber] [nvarchar](255) NULL,
	[COl1] [nvarchar](2550) NULL
) 
End

Insert into aNewTable20150729

SELECT * FROM OPENROWSET('MSDASQL','DRIVER=Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb);
DBQ=c:\temp\test8.xlsx','SELECT * FROM [Sheet1$]') 

select *, len(COL1)  from aNewTable20150729

truncate table aNewTable20150729


 
Advertisements


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s