ODBC Driver for 1010data

Build 22.0.8509

Executing Queries

This section describes how to execute queries to the Salesforce linked server from any tool that can connect to SQL Server. < p> When executing queries from a linked server, you must use a four-part name format, as shown below.

[<Linked Server Name>].[<DSN Name>].[<Schema Name (normally but not always the service name)>].[<Table Name>] 
where
  • Linked Server Name is the name of the linked server that you created.
  • DSN Name is the name of the data source.
  • Schema Name is the name of the system schema or user-defined schema.
  • Table Name is the name of the table you are copying data from.

SELECT Statements

To create new records:
SELECT * FROM [Linked Server Name].[CData C1010 Sys].[C1010].["tenten"."public".solar] WHERE orbits = 'sun'
Note that if the data source supports case-sensitive identifiers, it is not possible to query tables of the same name that only vary by casing (ex: Account and ACCOUNT in the same schema). This is due to the fact that SQL Server treats identifiers as case-insensitive, so multiple tables of the same name in a single schema are fundamentally incompatible with the SQL Server protocols.

INSERT, UPDATE, and DELETE Statements

To insert, update, or delete a single row of data (that is, not a batch of records), you need to use the four-part name. For example:
INSERT INTO [Linked Server Name].[CData C1010 Sys].[C1010].["tenten"."public".solar] (orbits) VALUES ('sun');

Bulk Operations

To perform bulk operations, you can use syntax similar to the following:

You can run a bulk INSERT using a SELECT query in place of a VALUES list.

INSERT INTO [Linked Server Name].[CData C1010 Sys].[C1010].["tenten"."public".solar] ([orbits])
SELECT [orbits] from [CData].[dbo].[Local_"tenten"."public".solar]
You can run a bulk UPATE using a JOIN with a local table.
UPDATE [Linked Server Name].[CData C1010 Sys].[C1010].["tenten"."public".solar] SET ["tenten"."public".solar].[orbits] = CData.dbo.[Local_"tenten"."public".solar].[Local_orbits]

FROM CData.dbo.[Local_"tenten"."public".solar] INNER JOIN [Linked Server Name].[CData C1010 Sys].[C1010].["tenten"."public".solar] ON CData.dbo.[Local_"tenten"."public".solar].[Id] = ["tenten"."public".solar].[Id]
You can run a bulk DELETE using the IN filter with sub-SELECT query.
DELETE FROM [Linked Server Name].[CData C1010 Sys].[C1010].["tenten"."public".solar] WHERE [Id] IN (SELECT [Id] FROM CData.dbo.Local_"tenten"."public".solar)

Execute Stored Procedures

To execute stored procedures, you must first enable RPC and RPC Out in the settings for the linked server. Then, you can use the following set of commands to run the stored procedure:
DECLARE @RunStoredProcSQL VARCHAR(1000);
SET @RunStoredProcSQL = 'EXEC NA NA=''NA''';
EXEC (@RunStoredProcSQL) AT [Linked Server Name];

Copyright (c) 2023 CData Software, Inc. - All rights reserved.
Build 22.0.8509