Showing posts with label exec. Show all posts
Showing posts with label exec. Show all posts

Friday, March 23, 2012

Error when importing data from Excel File

Hi!

This is what i'm doing:

IF EXISTS (SELECT srvname FROM master.dbo.sysservers srv WHERE srv.srvid !=

0 AND srv.srvname = N'ExcelSource')

EXEC master.dbo.sp_dropserver @.server=N'ExcelSource', @.droplogins='droplogins';
-
EXEC master.dbo.sp_addlinkedserver
@.server = 'ExcelSource',
@.srvproduct = 'Excel',
@.provider = 'Microsoft.Jet.OLEDB.4.0',
@.datasrc = @.Chemin,
@.provstr = 'Excel 8.0';

EXEC master.dbo.sp_addlinkedsrvlogin
@.rmtsrvname = 'ExcelSource',
@.useself = false,
@.locallogin = NULL,
@.rmtuser ='ADMIN',
@.rmtpassword = NULL;

set @.NomServ = 'ExcelSource';

This create a linkedServer to read my ExcelFile.

Then i'm doing this:

EXEC ('Insert into Elements (No_element, Nom_elem, Desc_elem, Code_grpe_classe, Tps_elem, Code_sgrpe, Code_produit)
Select No_element, Nom_elem, Desc_elem, Code_grpe_classe, Tps_elem, Code_sgrpe, Code_produit
from ' + @.NomServ + '...[Elements$];')

This is where i got an error. The error is:
The OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "ExcelSource" does not contain the table "Elements$". The table either does not exist or the current user does not have permissions on that table.

I can't figure out what i'm missing. I've add permissions for EVERYONE on the file and on the folder just to be sure and i still have the same error. How can i check if the table [Elements$] exist ?
I've forgot to mention that my excel spreadsheet name is Elements.|||I finally found what the problem was. One of my column name had the wrong Column name. Now it's working fine !

Friday, March 9, 2012

Error when attempt to link to exchange

hello,
I try to add exchange server as linked server in mssql on SBS2003.
I use sp_addlinkedserver :
EXEC sp_addlinkedserver 'exchange',
'Exchange OLE DB provider',
'exoledb.DataSource.1',
'file:\\.\backofficestorage\localhost\public folders
Now when trying to run a query or listing tables in EM I always get the
following error:
Error 7304: A new session on OLE DB-Provider
'exoledb.DataSource.1' could not be created.
OLE DB-Errortrace [OLE/DB Provider 'exoledb.DataSource.1'
IDBCreateSession::CreateSession returned 0x80150804].
Is there anybody out there who could help me;-)
regards
reinhold
1. Have you tried using a UDL connection to connect to the SQL server?
2. Please refer to 287534 PRB: ExOLEDB Provider Cannot Access or Create
Items Remotely http://support.microsoft.com/?id=287534 which explains some
more information.
thanks,
Vikram
Vikram Jayaram
Microsoft, SQL Server
This posting is provided "AS IS" with no warranties, and confers no rights.
Subscribe to MSDN & use http://msdn.microsoft.com/newsgroups.
|||Thanks Vikram,
I've resolved the problem in the meanwhile.
It was related to casesensitivity. When indicating path to webstorage via
"file://.." path must be casesensitive as it seems.
thanks
reinhold
"Vikram Jayaram [MS]" <vikramj@.online.microsoft.com> wrote in message
news:aAS$ZhobEHA.2880@.cpmsftngxa06.phx.gbl...
> 1. Have you tried using a UDL connection to connect to the SQL server?
> 2. Please refer to 287534 PRB: ExOLEDB Provider Cannot Access or Create
> Items Remotely http://support.microsoft.com/?id=287534 which explains some
> more information.
> thanks,
> Vikram
> Vikram Jayaram
> Microsoft, SQL Server
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> Subscribe to MSDN & use http://msdn.microsoft.com/newsgroups.
>

Error when attempt to link to exchange

hello,
I try to add exchange server as linked server in mssql on SBS2003.
I use sp_addlinkedserver :
EXEC sp_addlinkedserver 'exchange',
'Exchange OLE DB provider',
'exoledb.DataSource.1',
'file:\\.\backofficestorage\localhost\public folders
Now when trying to run a query or listing tables in EM I always get the
following error:
Error 7304: A new session on OLE DB-Provider
'exoledb.DataSource.1' could not be created.
OLE DB-Errortrace [OLE/DB Provider 'exoledb.DataSource.1'
IDBCreateSession::CreateSession returned 0x80150804].
Is there anybody out there who could help me;-)
regards
reinhold1. Have you tried using a UDL connection to connect to the SQL server?
2. Please refer to 287534 PRB: ExOLEDB Provider Cannot Access or Create
Items Remotely http://support.microsoft.com/?id=287534 which explains some
more information.
thanks,
Vikram
Vikram Jayaram
Microsoft, SQL Server
This posting is provided "AS IS" with no warranties, and confers no rights.
Subscribe to MSDN & use http://msdn.microsoft.com/newsgroups.|||Thanks Vikram,
I've resolved the problem in the meanwhile.
It was related to casesensitivity. When indicating path to webstorage via
"file://.." path must be casesensitive as it seems.
thanks
reinhold
"Vikram Jayaram [MS]" <vikramj@.online.microsoft.com> wrote in message
news:aAS$ZhobEHA.2880@.cpmsftngxa06.phx.gbl...
> 1. Have you tried using a UDL connection to connect to the SQL server?
> 2. Please refer to 287534 PRB: ExOLEDB Provider Cannot Access or Create
> Items Remotely http://support.microsoft.com/?id=287534 which explains some
> more information.
> thanks,
> Vikram
> Vikram Jayaram
> Microsoft, SQL Server
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> Subscribe to MSDN & use http://msdn.microsoft.com/newsgroups.
>

Error when attempt to link to exchange

hello,
I try to add exchange server as linked server in mssql on SBS2003.
I use sp_addlinkedserver :
EXEC sp_addlinkedserver 'exchange',
'Exchange OLE DB provider',
'exoledb.DataSource.1',
'file:\\.\backofficestorage\localhost\public folders
Now when trying to run a query or listing tables in EM I always get the
following error:
Error 7304: A new session on OLE DB-Provider
'exoledb.DataSource.1' could not be created.
OLE DB-Errortrace [OLE/DB Provider 'exoledb.DataSource.1'
IDBCreateSession::CreateSession returned 0x80150804].
Is there anybody out there who could help me;-)
regards
reinhold1. Have you tried using a UDL connection to connect to the SQL server?
2. Please refer to 287534 PRB: ExOLEDB Provider Cannot Access or Create
Items Remotely http://support.microsoft.com/?id=287534 which explains some
more information.
thanks,
Vikram
Vikram Jayaram
Microsoft, SQL Server
This posting is provided "AS IS" with no warranties, and confers no rights.
Subscribe to MSDN & use http://msdn.microsoft.com/newsgroups.|||Thanks Vikram,
I've resolved the problem in the meanwhile.
It was related to casesensitivity. When indicating path to webstorage via
"file://.." path must be casesensitive as it seems.
thanks
reinhold
"Vikram Jayaram [MS]" <vikramj@.online.microsoft.com> wrote in message
news:aAS$ZhobEHA.2880@.cpmsftngxa06.phx.gbl...
> 1. Have you tried using a UDL connection to connect to the SQL server?
> 2. Please refer to 287534 PRB: ExOLEDB Provider Cannot Access or Create
> Items Remotely http://support.microsoft.com/?id=287534 which explains some
> more information.
> thanks,
> Vikram
> Vikram Jayaram
> Microsoft, SQL Server
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> Subscribe to MSDN & use http://msdn.microsoft.com/newsgroups.
>