Hello Friends,
Microsoft added lots of new features in SQL Server Management Studio to make it more helpful tool. One more feature “Import Flat File…” option has been added by Microsoft in SSMS 17.3. By using this GUI feature we can import flat files data in SQL Server. This feature is more powerful as compare to “Import Data From flat file” option. You can download latest version of SQL Server Management Studio by click here.
For using this feature, you just have to right click on the database in which you want to import data using flat file. Then go to Tasks and then click on “Import Flat File…” option as shown below.
This will open up Import Flat File wizard. Here first page is Introduction Page where we can get some introductory details about this feature. If you don’t want to see this page next time, just check the Do not show this page again. Now click Next button to proceed.
After click on next, you will get specify input file page. Here you can specify input file by using browse button. By default table name will be same as file name. if you want, you can change table name here. Finally you can also specify the schema name, under which new table will be created for imported data.
After specifying this entire information, click on next. Then you will get preview page under this “Import Flat File…” wizard.
After click on next, you will get Modify Column page. Here you can change any column name, data type of column, specify primary key and allow nulls setting.
After making all required changes then click on next. Now you will be on Summary Page.
If everything is specified properly for all previous steps then click on Next to execute the import. After execution of import, you will be on result page. During execution, you will see “In Progress” status.
After completion, you will see result as Success or Failure.
Now click on close. Now you can check imported data in SQL Server using T-SQL select statement.
Note: By using this feature, you can import data from two type of flat files only i.e. text and csv.
HAPPY LEARNING!
Regards:
Prince Kumar Rastogi
Follow Prince Rastogi on Twitter | Follow Prince Rastogi on FaceBook