You are here: Re: Insert first n columns from select « MsSQL Server « IT news, forums, messages
Re: Insert first n columns from select

Posted by David Portas on 10/01/70 11:41

carlospedr@gmail.com wrote:
> I will explain,
> I started with and excel file, when i imported it to sql server i ended
> up with 30 odd tables, everyone of them had different column names
> result of different headers in the excel file,
> each of them, for some strange reason that i'm still to understand,
> with a diferent number of columns but the data was present was allways
> present on the first 5 columns
> My intention is/was to transform this tables into a RDB, the first sept
> i took was to build a sigle table with all the information from these
> over 30 tables, i know my script is too say the least un-ortodox but i
> do have a very strange representation of the data to start with.

Take care when importing data from Excel. The Excel OLEDB driver and
DTS can do some strange things when attempting to derive metadata from
spreasheets. A spreadsheet is not a table and it doesn't have any of
the nice properties we expect from tables such as keys, strict typing,
fixed precision, fixed number of columns, etc.

The best method is to create the target table(s) first. Then use DTS or
whatever to populate them from Excel. The bottom line is that Excel is
a lousy data interchange format.

--
David Portas, SQL Server MVP

Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.

SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация