Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sbealer/8663a0cbc896ade44ce55ea1ef844aa1 to your computer and use it in GitHub Desktop.
Save sbealer/8663a0cbc896ade44ce55ea1ef844aa1 to your computer and use it in GitHub Desktop.
Import csv into SQL Server without need of format file
INSERT INTO [YOURLINKEDSERVER].[YOURDB].[DBO].YOURTABLE
SELECT
*
,cast('2017-05-20' as date)
FROM OPENROWSET('MSDASQL'
, 'Driver={Microsoft Access Text Driver (*.txt, *.csv)};
DBQ=C:\first_directory\second_directory\'
, 'select * from "your_file.csv"')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment