title: Create table, and import data from csv or txt file
body: <p>I have a CSV file that contains stock quotes. I am  new when it comes to SQL, but I have done a lot of research and come up with a code that I thought should work. But it doesn't. I get errors all the way....</p>
  
  <pre><code>USE ShakeOut 
  GO
  CREATE TABLE CSVTest1
  (Ticker varchar(10),
  dateval smalldatetime),
  timevale time(),
  Openval varchar(10),
  Highval varchar(10),
  Lowval varchar(10),
  Closeval varchar(10),
  Volume varchar(10),
  )
  GO
  
  BULK
  INSERT CSVTest1
  FROM 'c:\TEST.txt'
  WITH
  (
  FIELDTERMINATOR = ',',
  ROWTERMINATOR = '\n'
  )
  GO
  --Check the content of the table.
  SELECT *
  FROM CSVTest1
  GO
  --Drop the table to clean up database.
  DROP TABLE CSVTest1
  GO
  </code></pre>
  
  <p>My CSV file has timevalue as 03:15:00 PM, and I'm not sure how to set that up in the table. The other values I think are aproxmately right, here's a sample of my csv file:</p>
  
  <pre><code>5/1/2009,9:30:00 AM,18.21,18.45,18.21,18.32,32163
  5/1/2009,9:35:00 AM,18.33,18.34,18.27,18.29,36951
  5/1/2009,9:40:00 AM,18.29,18.38,18.25,18.37,53198
  5/1/2009,9:45:00 AM,18.38,18.4,18.28,18.285,49491
  </code></pre>
  
  <p>And here is my error messages in SQL Management Studio:</p>
  
  <pre><code>Msg 102, Level 15, State 1, Line 4 Incorrect syntax near ','. Msg 208,
  Level 16, State 82, Line 3 Invalid object name 'CSVTest1'. Msg 208,
  Level 16, State 1, Line 3 Invalid object name 'CSVTest1'. Msg 3701,
  Level 11, State 5, Line 3 Cannot drop the table 'CSVTest1', because it
  does not exist or you do not have permission.
  </code></pre>
  
  <p>I would really appreciate help here, my head is about to explode after all these hours without any progression. I've tried MySQL too, didn't work there either.</p>
  
  <p>As I'm  new, I might need it explained to the details.</p>