Step 1: Following below is the sample flat file which need to be uploaded in SQL Server.
Flat File |
SQL Import Export Wizard |
Select the Data Source as "Flat File Source"
Browse the Flat file.
Set Header Row delimeter as "Tab"(depends how your flat file is delimited)
Tick the check box if first row of flat file contains column names.
Step-6 : On clicking NEXT,another window pops up. Fill the following as shown below with snapshot.
Select Destination as "SQL Server Native Client 10.0"
Select Server Name
Select Database as "tempdb"
Click NEXT
Step-7 : On clicking NEXT, another window pops up. Double click on the icon as shown below.
Step-8 On double clicking on icon in previous step, a following window pops up. Click on "EDIT SQL.." button.
Step-9: On Clicking the "EDIT SQL.." button, another window will pop up. Copy the SQL query.
Step-10: Paste the copied SQL query and add "##" before the table name to make it Global temporary table.
Step-11:Once the Global temp table has been created, close the pop up window which appeared in Step-8 and Step-9. After this go back to Step-6 by clicking "back" button, and then click on "Refresh" button. Then click "NEXT" button. Select the Global temp table from Destination as shown below.Once the temp table has been selected click "NEXT" button.
Step-12: On clicking "NEXT", following below window will appear. "Run immediately" check box will be ticked by default. If not then, tick it and click on "NEXT" and then click "FINISH".
Step-13: On clicking "FINISH" button, a window will appear with success message as follows:
Step-15: Click on "Close" button to close the wizard. Now execute the below query to check whether flat file has been imported successfully.
SELECT * FROM [dbo].[##Flatfile]
We see that flat file is imported to SQL Server successfully.
NOTE: If you like the article, do recommend on Google plus.
No comments:
Post a Comment