Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 OPENROWSET

Author  Topic 

vinay.a
Starting Member

20 Posts

Posted - 2008-04-09 : 01:59:50
Hi,
My name is vinay,
I'm trying to upload an xls file to the sql server database table.
I need to know about the 'OPENROWSET' and what:
HDR=YES and
Excel 8.0 implies.

I read the following post
"DO WE HAVE TO GIVE COL NAMES OF SHEET?", but was not able to understand.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-04-09 : 02:42:55
This is for export but the very same thing is used to import
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=49926



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

vinay.a
Starting Member

20 Posts

Posted - 2008-04-09 : 03:13:48
Thanks Peso. I appreciate your quick reply. That was helpful.
Can you please explain me how OPENROWSET works.
I need to know this because, I am trying to upload an xls file into sql server database.
It's now getting uploaded.
One of the columns (id) in the xls file is sometimes empty.
I need to identify such columns and generate an id programmatically, before inserting it into the database table, for which I need to read row by row from the xls file. Can you help me with this.

regards,
vinay
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-04-09 : 03:26:59
quote:
Originally posted by vinay.a

Thanks Peso. I appreciate your quick reply. That was helpful.
Can you please explain me how OPENROWSET works.
I need to know this because, I am trying to upload an xls file into sql server database.
It's now getting uploaded.
One of the columns (id) in the xls file is sometimes empty.
I need to identify such columns and generate an id programmatically, before inserting it into the database table, for which I need to read row by row from the xls file. Can you help me with this.

regards,
vinay



Why dont you export data to table and then update a table with numbers?
or you can have identity column in the table and insert into the table by omitting the number column from EXCEL

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -