I cook and take food photo. I build databases and love to talk about it.

Saturday, 27 September 2014

On 00:29 by Unknown in    4 comments
T-SQL BULK INSERT -  Import Text File into SQL Server Database Table

BULK INSERT - a handy T-SQL script to load text or csv file into SQL Server database table. 


T-SQL file download Link - BULK INSERT SQL FILE




/*

Description  :  Bulk Insert flat files (i.e. txt or csv files to 

                a SQL Server table 

CODEPAGE value  Description
--ACP  Columns of char, varchar, or text data type are converted 

from the ANSI/Microsoft Windows® code page (ISO 

1252) to the SQL Server code page.
--OEM (default)  Columns of char, varchar, or text data type 

are converted from the system OEM code page to the 

SQL Server code page.
--RAW  No conversion from one code page to another occurs; 

this is the fastest option.
--code_page  Specific code page number, for example, 850.
For more  : http://technet.microsoft.com/en-us/library/aa225968(v=sql.80).aspx
*/
 


BULK INSERT tablename
  FROM '\\filePath\folder\file.txt'
  WITH
    (
      -- For Tab delimitted 
      -- FIELDTERMINATOR = '\t'
      fieldterminator = ',',
      rowterminator = '\n',
      codepage ='ACP'
    ) 




T-SQL file download Link - BULK INSERT SQL FILE

4 comments:

  1. ERPTREE Offering Oracle fusion HCM online training, Oracle Fusion SCM Online Training, Oracle fusion financials online training, Oracle fusion hcm training, Oracle fusion scm training, Oracle fusion financials training, Oracle fusion dba online training in Hyderabad, Bangalore,Gurgon, Noida, India, Dubai, UAE, USA, Kuwait, UK, Singapore, Saudi Arabia, Canada, Delhi, Chennai, Kolkata, Pune, Mumbai, Ahmedabad.


    Oracle fusion HCM Online Training

    Oracle Fusion HCM Training

    ReplyDelete
  2. The distinguishing factor between the record and relational database is the flexibility and added capabilities characteristic of a relational database.create dashboard for oracle

    ReplyDelete
  3. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a .Net developer learn from Dot Net Training in Chennai. or learn thru ASP.NET Essential Training Online . Nowadays Dot Net has tons of job opportunities on various vertical industry.

    ReplyDelete
  4. Thanks for sharing nice informative post, Hope you will share many more articles so that it will be helpful for many of us.

    Oracle Fusion Financials Online Training

    ReplyDelete