dbTalk Databases Forums  

Populate a DB from Excel

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


Discuss Populate a DB from Excel in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
new.smicrosoft.com
 
Posts: n/a

Default Populate a DB from Excel - 01-05-2005 , 08:17 PM






Hi,

I am writing an installer for a database driver application. The installer
is supposed to create the DB, tables and populate the tables with sample
data from an excel file.

The excel file containing the sample is generated via the DTS wizard from an
existing production DB.

The application will be installed on a system different fromt he one where
the SQL server is installed.

At this point I am able to create the DB and the Table using vbscript. I am
howerver not able to impor the data from the excel sheet.

It seems the excel sheet needs to be stored locally on the SQL server
machine for import to work .. is this correct ?

Is there any other way to populate the remote DB using an excel file on my
machine.

- Rohit



Reply With Quote
  #2  
Old   
William Wang[MSFT]
 
Posts: n/a

Default RE: Populate a DB from Excel - 01-05-2005 , 09:00 PM






Hi Rohit,

You may want to add a linked server points to the Excel
file on your machine. To do this you need to place the
Excel in a shared folder on your machine and run a
command similar to the following against the SQL Server:

sp_addlinkedservr @server='LinkedExcel', @srvproduct='',
@provider='Microsoft.Jet.OLEDB.4.0',
@datasrc='\\yourmachinename\sharedfolder\excelfile name.xl
s', @provstr='Excel 5.0'

Then you consider LinkedExcel to be a SQL Server and run
a INSERT...SELECT to populate the data. Please refer to
the following topic in BOL for more information:

http://msdn.microsoft.com/library/en...ata/ac_8_md_03
_8vhw.asp

If anything is unclear, feel free to let me know.

Sincerely,

William Wang
Microsoft Online Partner Support

Get Secure! - <www.microsoft.com/security>

================================================== ===
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
================================================== ===
This posting is provided "AS IS" with no warranties, and
confers no rights.

--------------------
Quote:
From: "new.smicrosoft.com" <123 (AT) 123 (DOT) com
Subject: Populate a DB from Excel
Date: Thu, 6 Jan 2005 07:47:33 +0530
Lines: 24
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
Message-ID: <OdO2L#18EHA.1692 (AT) TK2MSFTNGP10 (DOT) phx.gbl
Newsgroups: microsoft.public.sqlserver.dts
NNTP-Posting-Host: 61.1.101.126
Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFT NGP08.p
hx.gbl!TK2MSFTNGP10.phx.gbl
Quote:
Xref: cpmsftngxa10.phx.gbl
microsoft.public.sqlserver.dts:54121
X-Tomcat-NG: microsoft.public.sqlserver.dts

Hi,

I am writing an installer for a database driver
application. The installer
is supposed to create the DB, tables and populate the
tables with sample
data from an excel file.

The excel file containing the sample is generated via
the DTS wizard from an
existing production DB.

The application will be installed on a system different
fromt he one where
the SQL server is installed.

At this point I am able to create the DB and the Table
using vbscript. I am
howerver not able to impor the data from the excel
sheet.

It seems the excel sheet needs to be stored locally on
the SQL server
machine for import to work .. is this correct ?

Is there any other way to populate the remote DB using
an excel file on my
machine.

- Rohit





Reply With Quote
  #3  
Old   
Avadhesh
 
Posts: n/a

Default RE: Populate a DB from Excel - 01-10-2005 , 02:20 AM



Hi William,
Thanks for your suggestion. I am also working with Rohit on the same
problem.

For populating a database from an Excel file, Does a linked server
really require?. Can't we use distributed queries such as

SELECT * INTO XLImport3 FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',
'Data Source=C:\test\xltest.xls;Extended Properties=Excel 8.0')...[Customers$]

But for this, also the file should be on the server. The workaround, you
were suggesting will also involve domain username and password, if the server
is not on the same domain. Probably we will not be allowed to create a share.
Are there any other workarounds for such a problem. Excel file is not a
constraint. We can use any other type of file
or any other way of getting data from the Server.

We have come up with a solution in which we will create the DTS package
manually and ship the Excel file and DTS package both. We know, how to run a
DTS package from vbscript. But we are not happy with this solution, it seems
as if we unnessasorily shipping the DTS package also.

Are there any other ways. Your suggestions will be most welcome.

Thanks in advance,

- Avadhesh


"William Wang[MSFT]" wrote:

Quote:
Hi Rohit,

You may want to add a linked server points to the Excel
file on your machine. To do this you need to place the
Excel in a shared folder on your machine and run a
command similar to the following against the SQL Server:

sp_addlinkedservr @server='LinkedExcel', @srvproduct='',
@provider='Microsoft.Jet.OLEDB.4.0',
@datasrc='\\yourmachinename\sharedfolder\excelfile name.xl
s', @provstr='Excel 5.0'

Then you consider LinkedExcel to be a SQL Server and run
a INSERT...SELECT to populate the data. Please refer to
the following topic in BOL for more information:

http://msdn.microsoft.com/library/en...ata/ac_8_md_03
_8vhw.asp

If anything is unclear, feel free to let me know.

Sincerely,

William Wang
Microsoft Online Partner Support

Get Secure! - <www.microsoft.com/security

================================================== ===
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
================================================== ===
This posting is provided "AS IS" with no warranties, and
confers no rights.

--------------------
From: "new.smicrosoft.com" <123 (AT) 123 (DOT) com
Subject: Populate a DB from Excel
Date: Thu, 6 Jan 2005 07:47:33 +0530
Lines: 24
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
Message-ID: <OdO2L#18EHA.1692 (AT) TK2MSFTNGP10 (DOT) phx.gbl
Newsgroups: microsoft.public.sqlserver.dts
NNTP-Posting-Host: 61.1.101.126
Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFT NGP08.p
hx.gbl!TK2MSFTNGP10.phx.gbl
Xref: cpmsftngxa10.phx.gbl
microsoft.public.sqlserver.dts:54121
X-Tomcat-NG: microsoft.public.sqlserver.dts

Hi,

I am writing an installer for a database driver
application. The installer
is supposed to create the DB, tables and populate the
tables with sample
data from an excel file.

The excel file containing the sample is generated via
the DTS wizard from an
existing production DB.

The application will be installed on a system different
fromt he one where
the SQL server is installed.

At this point I am able to create the DB and the Table
using vbscript. I am
howerver not able to impor the data from the excel
sheet.

It seems the excel sheet needs to be stored locally on
the SQL server
machine for import to work .. is this correct ?

Is there any other way to populate the remote DB using
an excel file on my
machine.

- Rohit






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.