home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 17,509 of 19,505   
   Erland Sommarskog to bevanward@gmail.com   
   Re: large import SQL Server 2005   
   27 May 09 21:56:18   
   
   332ad8c3   
   From: esquel@sommarskog.se   
      
    (bevanward@gmail.com) writes:   
   > I have a large csv file to import into a SQL Server 2005 database as   
   > an intermediate step to processing. The file has over 900 columns and   
   > 500,000 rows. The columns have different widths however it would be   
   > fine to make them all varchar(255).   
   >   
   > I have been using the "Import Data ..." feature however finding I   
   > would need to manually set all column widths from 50 to 255 manually.   
   >   
   > If I use the "Sugest Types ..." feature to determine the string length   
   > it will only read down 10000 lines so it is not determining the   
   > correct width and is resulting in truncation.   
   >   
   > Does anyone know of a way to do this automatically using "Data   
   > Import ..." or is it easiest to go back to bcp or bulk insert?   
      
   BCP or BULK INSERT certainly seems easier than dealing with point-and-click   
   GUI:n that are not repeatable. However, if the quoting in the file is   
   not consistent, BCP/BULK INSERT is not going to work out anyway.   
      
   As for the table definition and the format file, you could write a small   
   program in VBA or whatever to generate them.   
      
      
   --   
   Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se   
      
   Links for SQL Server Books Online:   
   SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx   
   SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx   
   SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca