Friday, June 10, 2011

How to Import Excel 2010 xlsx to SQL 2008 R2 64-bit

First of all:
You cannot connect a 32-bit office to a 64-bit SQL. Period.

You need:
64-bit OS
Windows Server 2008 64-bit
Office 2010 64-bit
2010 64-bit OLEDB Drivers
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=c06b8369-60dd-4b64-a44b-84b371ede16d


Go to SQL Management Studio,
Log in as SA
 run this
------------------------------------------------------------
sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Ad Hoc Distributed Queries', 1;
GO
RECONFIGURE;
GO


USE [master]
GO

EXEC master . dbo. sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0' , N'AllowInProcess' , 1
GO

EXEC master . dbo. sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0' , N'DynamicParameters' , 1
GO

(Original Post)
------------------------------------------------------------

Save your excel file as C:\db\myfile.xlsx
Run this
-------------------------------------------------------------
SELECT * FROM OPENROWSET ( 'Microsoft.ACE.OLEDB.12.0',
'Excel 12.0; Database=C:\db\myfile.xlsx;HDR=Yes', 'Select * from [sheet1$]' )
or
'Excel 12.0; Database=C:\db\myfile.xlsx;HDR=Yes', 'Select * from [sheet1 - table 1$]' )
--------------------------------------------------------------

For 32-Bit Excel, and SQL use
--------------------------------------------------------------
SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
    'Excel 8.0;HDR=YES;Database=C:\temp\test.xls',
    'select * from [sheet1$]')

Database: Path and name of your excel file
HDR: Yes/No if to include headers or not
Sheet1$: Replace with the sheet name you want to access in your excel file (leave the $ on the end)

You should be able to access your excel file.

Tuesday, June 7, 2011

Dynamics GP SSRS: The deployment has exceeded the maximum request length allowed by the target server.


Go to 
c:\Program Files\Microsoft SQL Server\(SRS Instance)\Reporting Services\ReportServer\web.config 

Find
<httpRuntime executionTimeout="9000" />
Change it to (<httpRuntime executionTimeout="9000" maxRequestLength="20960"/>).

Related Error:
"an error occurred when invoking the authorization extension"

You will get this error when attempting to connect to your SSRS if you have mistyped, or badly edited your web.config file.
Review the line and ensure it is exactly

<httpRuntime executionTimeout="9000" maxRequestLength="40960"/>

Friday, June 3, 2011

SQL E-mail Setup - Not sending e-mail

The service account that sql is running under must have access to the exchange server

This same service should be used to run all sql services