an ODBC driver?
The QuickBooks Online ODBC driver enables you to work with QuickBooks Online data in SQL Server just as if you were working with data stored in a SQL Server table.
Download the QuickBooks Online ODBC driver. Then follow the instructions in this article to install and license the driver and set up the ODBC data source that enables you to connect SQL Server to QuickBooks online.
You need to log on with an account that is a member of the SQL Server sysadmin
fixed server role to create a linked server.
The Microsoft OLE DB Provider for ODBC Drivers Provider Options dialog box is displayed.
If you don't do this, you will get a "linked server contains multiple tables that match the table table name." error when querying your QuickBooks Online data with a 4 part T-SQL query.
QBONLINE
.SQL Server verifies the linked server by testing the connection.
PATH
environment variable. The QuickBooks Online ODBC driver Setup program adds entries for the driver to the System PATH
. Restarting the instance makes these changes available to SQL Server, allowing it to load the QuickBooks Online ODBC driver.A four-part table name has the format:
server_name.[database_name].[schema_name].table_name
QuickBooks Online does not have a database name or schema, so omit these from your SQL statement. For example:
SELECT * FROM QBONLINE...Account
The capitalisation of the table name must be the same as it is in QuickBooks Online. For example, the following query is invalid:
SELECT * FROM QBONLINE...ACCOUNT
To check the capitalisation of the QuickBooks Online tables (objects), run:
EXEC sp_tables_ex @table_server = 'QBONLINE'
OPENQUERY
function. For example:
SELECT * FROM OPENQUERY (QBONLINE, 'SELECT * FROM ACCOUNT')
SQL Server sends pass-through queries as uninterpreted query strings to the QuickBooks Online ODBC driver. This means that SQL Server does not apply any kind of logic to the query or try to estimate what that query will do.
OPENDATASOURCE
and OPENROWSET
The OPENDATASOURCE
or OPENROWSET
functions enable you to work with QuickBooks Online data without configuring a linked server. There are some security implications associated with their use and they are not therefore enabled by default.
OPENDATASOURCE
and OPENROWSET
functions:
EXEC sp_configure 'show advanced options', 1
RECONFIGURE
GO
EXEC sp_configure 'ad hoc distributed queries', 1
RECONFIGURE
GO
SELECT * FROM OPENDATASOURCE('MSDASQL', 'DSN=MY_QUICKBOOKSONLINE_ODBC_DATA_SOURCE;') .SF.DBO.Account
–Or–
SELECT * FROM OPENROWSET('MSDASQL', 'DSN=MY_QUICKBOOKSONLINE_ODBC_DATA_SOURCE;', 'select * from Account;')
This command creates a copy of the Account table. It assumes the linked server is named QBONLINE
.
IF OBJECT_ID('dbo.Account', 'U') IS NOT NULL DROP TABLE dbo.Account;
SELECT * INTO Account FROM OPENQUERY(QBONLINE,'SELECT * FROM Account')