Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 9th, 2012  |  syntax: None  |  size: 0.44 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Splitting a string and insert into a database
  2. Line1: 00001, Some name, Address, Email
  3. Line2: 00002..
  4.        
  5. ID      | Name        | Address      | Email    |   <-- Columns
  6.  
  7. 000001  | Some name   | Some street  | @mail    |   <-- Data inserted
  8.  
  9. 000002 etc.
  10.        
  11. BULK INSERT Contact
  12. FROM 'c:TestData.csv'  -- Full path of the Delimited file
  13. WITH
  14. (
  15. FIELDTERMINATOR = ',', --CSV field delimiter
  16. ROWTERMINATOR = 'n'   --Use to shift the control to next row
  17. )