Importing csv file into SQL Server - best approach

%3CLINGO-SUB%20id%3D%22lingo-sub-1672018%22%20slang%3D%22en-US%22%3EImporting%20csv%20file%20into%20SQL%20Server%20-%20best%20approach%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1672018%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20All%2C%3C%2FP%3E%3CP%3EI%20want%20to%20import%20csv%20file%20into%20sql%20server%2C%20If%20I%20use%20SQL%20Server%20importing%20wizard%20then%20how%20can%20I%20deploy%20the%20same%20into%20production%20as%20it%20requires%20manual%20steps.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20please%20suggest%20the%20best%20possible%20way%20to%20import%20csv%20file%20into%20SQL%20Server.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1677928%22%20slang%3D%22en-US%22%3ERe%3A%20Importing%20csv%20file%20into%20SQL%20Server%20-%20best%20approach%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1677928%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20Import%2FExport%20wizard%20creates%20a%20SSIS%20package%20in%20background%20and%20execute%20it.%3C%2FP%3E%3CP%3EYou%20can%20save%20that%20package%20at%20the%20end%20of%20the%20wizard%20instead%20of%20executing%20it%20immediately%2C%20that%20you%20can%20reuse%20the%20package%2C%20also%20on%20prod.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOr%20you%20create%20manually%20a%20package%2C%20that's%20more%20flexible%3A%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Fintegration-services%2Fload-data-to-from-excel-with-ssis%3Fview%3Dsql-server-ver15%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3E%3CFONT%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Ft-sql%2Fstatements%2Fmerge-transact-sql%3Fview%3Dsql-server-ver15%3C%2FFONT%3E%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%3EA%20SSIS%20package%20can%20also%20be%20executed%20from%20an%20Agent%20job%2C%20if%20you%20want%20to%20automize%20the%20process.%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

Hi All,

I want to import csv file into sql server, If I use SQL Server importing wizard then how can I deploy the same into production as it requires manual steps.

 

So please suggest the best possible way to import csv file into SQL Server.

 

Thanks!

 

 

1 Reply

The Import/Export wizard creates a SSIS package in background and execute it.

You can save that package at the end of the wizard instead of executing it immediately, that you can reuse the package, also on prod.

 

Or you create manually a package, that's more flexible:

https://docs.microsoft.com/en-us/sql/t-sql/statements/merge-transact-sql?view=sql-server-ver15

 

A SSIS package can also be executed from an Agent job, if you want to automize the process.