Importing flat file Wizard

SSMS was designed to make regular tasks of DBAs and developers easier. Wizards were built for many different tasks to guide users to a quicker solution. There was one area that remained frustrating: the simple task of importing a flat file (CSV or TXT file). This seemingly basic functionality was mired by a clumsy and irritating Import and Export Wizard, which often made the task of importing data more difficult rather than easier.

With SSMS 17.3 came some relief! The Import Flat File Wizard removes much of the earlier unnecessary complexities of importing flat files into SQL Server. The wizard can be found using a right-click on a desired database name, then under the menu Tasks, as shown in the following screenshot:

Import Flat File Wizard

The wizard that appears guides the user through a handful of steps to easily import flat files into a target table inside SQL Server.

Now, let's see the steps to import Flat File Wizard:

  1. The flat file is chosen from the filesystem, with the wizard automatically suggesting a table name based on the filename. The schema for creating/storing the table must be chosen from the schemas already available in the target database, as shown in the following screenshot:
Import Flat File Wizard 
  1. The next step of the wizard provides a preview of the first 50 rows of data in the flat file. The wizard parses the data and shows the columns that have been identified in the file, as shown in the following screenshot:
Import Flat File—data preview
  1. The data preview shows how the wizard has interpreted the rows and columns; if this analysis is incorrect, the schema of the new target table can be altered in the next step of the wizard, as shown in the following screenshot:
Import Flat File—Modify Columns

Once we are happy with the target schema, the import is summarized and then started by the wizard. The flat file data is rapidly imported into the new table and the import process completes. This is a big step forward from the previous incarnation of an import wizard and should make it easier to import data into SQL Server with much less hassle.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.238.134