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 2005 Forums
 SSIS and Import/Export (2005)
 Use DML statements in Openrowset, etc

Author  Topic 

srinivas.alwala
Starting Member

30 Posts

Posted - 2008-08-22 : 02:38:47
Hi,

I would like to retrieve data from an excel workbook by the foll way :

SELECT * FROM
OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C:\Source\xyz.xls;IMEX=1',
'SELECT * FROM [Sheet1$]')

Now, I need to fire a DML statement instead of
'SELECT * FROM [Sheet1$]'

I tried the same by foll ways :

1. SELECT * FROM
OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C:\Source\xyz.xls;IMEX=1',
'Delete FROM [Sheet1$]')
2. Delete FROM
OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C:\Source\xyz.xls;IMEX=1',
'Delete FROM [Sheet1$]')

3. Delete FROM
OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C:\Source\xyz.xls;IMEX=1',
'Select * FROM [Sheet1$]')

I would like to know whether DML statements are allowed to manipulate data of an excel workbook.

If anybody have a solution for the same, kindly let me know.

Regards,

Srinivas Alwala



visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-22 : 02:51:18
I dont think you can delete it directly. see below

http://support.microsoft.com/kb/257819
Go to Top of Page
   

- Advertisement -