76c6a08f885d7ebec1f619cc68a6440f449e9e57
FAQ/upload-csv-data-to-sql-server.md
| ... | ... | @@ -0,0 +1,33 @@ |
| 1 | +#How to Upload CSV Data to SQL Server |
|
| 2 | + |
|
| 3 | +[[_TOC_]] |
|
| 4 | + |
|
| 5 | +## Prerequisites |
|
| 6 | +1. You must obtain the csvetl.exe program which is distributed as a part of the Izenda Fusion product |
|
| 7 | +2. Access to SQL Server with permissions to modify an existing table, or permissions to create a new table |
|
| 8 | + |
|
| 9 | +## SQL Server Setup |
|
| 10 | +From within SQL Server Manager |
|
| 11 | +1. Create a new login by right clicking on (<ServerName> -> Security -> Logins) and choose "New Login" |
|
| 12 | + * Choose SQL Server authentication, choose a username and password. Disable "User must change password at next login". |
|
| 13 | +2. Choose the Database you want to upload the data to (<ServerName> -> Databases). If you want to create a new Database, right click on (<ServerName> -> Databases) and choose "New Database". After choosing or creating your Database, right click on (<ServerName> -> Databases -> <YourDatabase> -> Security -> Users) and choose "SQL user with login" and enter the login for the username and the login fields. Next choose the Membership page and checkmark "db_owner". Click OK. |
|
| 14 | + |
|
| 15 | +## csvetl usage |
|
| 16 | +```bash |
|
| 17 | +Usage: csvetl.exe <work mode> <connection string> <file> [file] .... [file] |
|
| 18 | +``` |
|
| 19 | +* Where work mode can be: |
|
| 20 | + * recreate - for recreating tables |
|
| 21 | + * append - for inserting values to existing tables without recreation |
|
| 22 | + |
|
| 23 | +The table created or appended to will be named after the imported CSV file without the extension |
|
| 24 | + |
|
| 25 | +Example: Create the products table with a CSV file called products.csv using the connection string |
|
| 26 | + |
|
| 27 | +```winbatch |
|
| 28 | +csvetl recreate "server=DEV6;database=northwind;User Id=northwind; |
|
| 29 | + Password=northwind;" products.csv |
|
| 30 | +``` |
|
| 31 | + |
|
| 32 | +### Screencast |
|
| 33 | +http://screencast.com/t/LyjCp1TMI1qV |
|
| ... | ... | \ No newline at end of file |