TxtFolderPath.Text = oAppSetting.GetSetting( " FolderPath") Object, e As System.EventArgs) Handles MyBase.Load Private Sub frmExport_Load(sender As System. Private bStop As Boolean = False Dim oAppSetting As New AppSettingįriend WithEvents chkHideNotSelected As ĭim oSqlScriptWriter As System.IO.StreamWriter = Nothing Friend WithEvents selDelimiter As ComboBoxįriend WithEvents chkShrinkTable As CheckBoxįriend WithEvents btnDeleteFolderCache As Buttonįriend WithEvents btnShrinkTables As Buttonįriend WithEvents chkNvarChar As CheckBoxįriend WithEvents chkScriptToFile As CheckBoxįriend WithEvents chkBulkInsert As CheckBox The application uses TextFieldParser to read CSV files. Script to File - will log to file instead of executing the SQL.Check New Rec - check tables that different source and destination count.Delete before insert - will delete all records before coping data.Add rec_id - will add primary key called rec_id identity(1,1).Create target table - will create table if it does not exist.But if Shrink table is checked, the application will attempt to detect and change data types based on the data. The imported files will be of varchar(max) / varchar(max) type (depending on Use nvarchar setting). The application will create tables in the SQL server database and copy the data. This application is fairly simple: you select the folder where CSV files reside, select the SQL Server database you want to copy the tables, select the tables you want to copy and click Copy tables. I hope someone else will also find this code useful. The application assumes that the first row contains column names. It was too much trouble importing the files using SSIS and SSMS import flat file feature. I developed this application to help me migrate CSV files to SQL Server.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |