dbTalk Databases Forums  

Validation of Excel columns before Transform

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Validation of Excel columns before Transform in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Brian
 
Posts: n/a

Default Validation of Excel columns before Transform - 11-12-2003 , 03:04 AM






Hello All,

Could anybody advise on the following ?

We have a situation where we need to import an Excel file into a SQL Server
table. Before we import the file, we would like to validate it by checking
the number of columns that exist in the Excel file (columns with data only).

Have you ever done something like this? Could you suggest the easiest way to
do this?

Thank you.



Regards, Brian.





Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Validation of Excel columns before Transform - 11-12-2003 , 08:51 AM






So you do not know how many columns of data you have up front ?

You can do this

Create a linked server of the Excel spreadsheet

Use a SELECT INTO to load it into a working table

Use a COUNT(*) from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = 'Your
Working Table'



--

Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Brian" <brian.perks (AT) investecmail (DOT) com> wrote

Quote:
Hello All,

Could anybody advise on the following ?

We have a situation where we need to import an Excel file into a SQL
Server
table. Before we import the file, we would like to validate it by checking
the number of columns that exist in the Excel file (columns with data
only).

Have you ever done something like this? Could you suggest the easiest way
to
do this?

Thank you.



Regards, Brian.







Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.