Inserting SQL Server data into Salesforce

After you've connected SQL Server to Salesforce, how you insert data depends on the Salesforce data type of the target columns. For example, given a simple custom Salesforce table that contains two text fields, both of the following SQL statements are valid:

INSERT INTO
    MYSALESFORCELINKEDSERVER.SF.DBO.Test__c (Name, Mth__c)
VALUES
    ('Test', 'Jan') INSERT OPENQUERY (
        MYSALESFORCELINKEDSERVER,
        'SELECT Name, Mth__c FROM Test__c'
    )
VALUES
    ('Test 2', 'JAN');

The Salesforce data types that we're aware of that requires an alternative approach are text area and long text area. For example:

INSERT INTO
    MYSALESFORCELINKEDSERVER.SF.DBO.Product2 (Name, Description, Family)
VALUES
    (
        'Easysoft ODBC-Oracle Driver',
        'ODBC Driver for Oracle 8-23',
        'Easysoft Data Access'
    )

is a valid insert statement, but fails because SQL Server does not support what it is attempting to do:

OLE DB provider "MSDASQL" for linked server "MYSALESFORCELINKEDSERVER" returned
message "Query-based insertion or updating of BLOB values is not supported.".

and you need to use an alternative to work around this:

EXEC (
    'INSERT INTO Product2 ( [Name], ProductCode, [Description] ) VALUES ( ''Easysoft ODBC-Oracle Driver'', ''ODBC Driver for Oracle 8-23'', ''Easysoft Data Access'')'
) AT MYSALESFORCELINKEDSERVER

Our insert related articles are:

Update examples: