• Roberto Luengo
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 5
    Replies
Hello community,

I am still stuck using the Data Loader with SQL Server. It is working great to move data from SQL Server to Salesforce, with one exception.

Everytime I use an @ in the SQL it returns an error and I believe it is because of the parameters you could pass to the SQL. However, these @s are legitimate. An example is doing an @DECLARE in the SQL to define a SQL Server variable.

Any idea?
. How do I escape the @ so Data Loader does not return an error?
. How do I use a different syntax in SQL Server so it understands @DECLARE without Data Loader breaking (e.g. ascii code)
. How do I pass a value to a Data Loader parameter by the command line (thinking that I could pass the @DECLARE string and thus bypass this problem)
 
Hello community,

I have an error that is driving me crazy here.

I am doing a data upload from SQL Server to Salesforce, it has been working great with other SQLs but it is returning an error with the latest one I am implementing... Please advise?

SQL (reduced to the minimum expression, keep in mind the last select is to return the fields I have mapped to avoid an error)

DECLARE    @StartDate datetime = DATEDIFF(dd, 0,DATEADD(month, -5, GETDATE())) + convert(datetime, '00:00:00');
DECLARE    @EndDate datetime = DATEDIFF(dd, 0,DATEADD(day, -1, GETDATE())) + convert(datetime, '23:59:59');
DECLARE    @CountryCodes varchar(max)=null;
DECLARE    @AccountTypes varchar(max)='property';

if object_id('tempdb..#CountryCodes') is not null drop table #CountryCodes
select    CountryCode = convert(varchar(5), data)
into    #CountryCodes
from    dbo.Split(@CountryCodes, ',') a
where    nullif(data, '') is not null 

if object_id('tempdb..#AccountTypes') is not null drop table #AccountTypes
select    AccountType = convert(varchar(50), data)
into    #AccountTypes
from    dbo.Split(@AccountTypes, ',') a
where    nullif(data, '') is not null 

select '201705INT66942' as PerfDataID, 'test' as test
from dbo.Split('abc', ',')

Error returned

2017-06-21 01:45:37,892 ERROR [propertyMonthlyPerformanceData] action.AbstractAction handleException (AbstractAction.java:222) - Exception occured during loading
com.salesforce.dataloader.exception.DataAccessObjectInitializationException: Unmatched closing ')' near index 17
@CountryCodes, ',')
where    nullif(data, '') is not null 

if object_id('tempdb..#AccountTypes') is not null drop table #AccountTypes
select    AccountType = convert(varchar(50), data)
into    #AccountTypes
from    dbo.Split(@
                 ^
    at com.salesforce.dataloader.dao.database.DatabaseReader.open(DatabaseReader.java:115)
    at com.salesforce.dataloader.dao.database.DatabaseReader.open(DatabaseReader.java:99)
    at com.salesforce.dataloader.action.AbstractAction.execute(AbstractAction.java:123)
    at com.salesforce.dataloader.controller.Controller.executeAction(Controller.java:121)
    at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:149)
    at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:100)
    at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.java:253)
Caused by: java.util.regex.PatternSyntaxException: Unmatched closing ')' near index 17
@CountryCodes, ',')
where    nullif(data, '') is not null 

if object_id('tempdb..#AccountTypes') is not null drop table #AccountTypes
select    AccountType = convert(varchar(50), data)
into    #AccountTypes
from    dbo.Split(@
                 ^
    at java.util.regex.Pattern.error(Unknown Source)
    at java.util.regex.Pattern.compile(Unknown Source)
    at java.util.regex.Pattern.<init>(Unknown Source)
    at java.util.regex.Pattern.compile(Unknown Source)
    at java.lang.String.replaceFirst(Unknown Source)
    at com.salesforce.dataloader.dao.database.DatabaseContext.replaceSqlParams(DatabaseContext.java:134)
    at com.salesforce.dataloader.dao.database.DatabaseReader.setupQuery(DatabaseReader.java:123)
    at com.salesforce.dataloader.dao.database.DatabaseReader.open(DatabaseReader.java:111)
    ... 6 more
2017-06-21 01:45:37,892 ERROR [propertyMonthlyPerformanceData] progress.NihilistProgressAdapter doneError (NihilistProgressAdapter.java:58) - Unmatched closing ')' near index 17
@CountryCodes, ',')
where    nullif(data, '') is not null 

if object_id('tempdb..#AccountTypes') is not null drop table #AccountTypes
select    AccountType = convert(varchar(50), data)
into    #AccountTypes
from    dbo.Split(@
                 ^

 
Hey Community,

I am using the Data Loader, but I am at a lost on two items...

How do you setup two DB connections? I have one from which I get data to upload to Salesforce, but now I need to connect to the data warehouse
My file containing the SQLs is growing too large. I want to have a file per SQL or per bean. How can I achieve this?
Hello everyone,

I know this has been asked a few times but so far none of the solutions provided work.

I want to disable Chatter Answers which I enabled by mistake in Production.

I have deleted everything in this URL (https://help.salesforce.com/articleView?id=000181537&type=1) except for the classes and trigger.

That is the problem, I have tried with the Developer Console (not possible), with Eclipse (times out) and this is not in the sandbox.
Hello community,

I have an error that is driving me crazy here.

I am doing a data upload from SQL Server to Salesforce, it has been working great with other SQLs but it is returning an error with the latest one I am implementing... Please advise?

SQL (reduced to the minimum expression, keep in mind the last select is to return the fields I have mapped to avoid an error)

DECLARE    @StartDate datetime = DATEDIFF(dd, 0,DATEADD(month, -5, GETDATE())) + convert(datetime, '00:00:00');
DECLARE    @EndDate datetime = DATEDIFF(dd, 0,DATEADD(day, -1, GETDATE())) + convert(datetime, '23:59:59');
DECLARE    @CountryCodes varchar(max)=null;
DECLARE    @AccountTypes varchar(max)='property';

if object_id('tempdb..#CountryCodes') is not null drop table #CountryCodes
select    CountryCode = convert(varchar(5), data)
into    #CountryCodes
from    dbo.Split(@CountryCodes, ',') a
where    nullif(data, '') is not null 

if object_id('tempdb..#AccountTypes') is not null drop table #AccountTypes
select    AccountType = convert(varchar(50), data)
into    #AccountTypes
from    dbo.Split(@AccountTypes, ',') a
where    nullif(data, '') is not null 

select '201705INT66942' as PerfDataID, 'test' as test
from dbo.Split('abc', ',')

Error returned

2017-06-21 01:45:37,892 ERROR [propertyMonthlyPerformanceData] action.AbstractAction handleException (AbstractAction.java:222) - Exception occured during loading
com.salesforce.dataloader.exception.DataAccessObjectInitializationException: Unmatched closing ')' near index 17
@CountryCodes, ',')
where    nullif(data, '') is not null 

if object_id('tempdb..#AccountTypes') is not null drop table #AccountTypes
select    AccountType = convert(varchar(50), data)
into    #AccountTypes
from    dbo.Split(@
                 ^
    at com.salesforce.dataloader.dao.database.DatabaseReader.open(DatabaseReader.java:115)
    at com.salesforce.dataloader.dao.database.DatabaseReader.open(DatabaseReader.java:99)
    at com.salesforce.dataloader.action.AbstractAction.execute(AbstractAction.java:123)
    at com.salesforce.dataloader.controller.Controller.executeAction(Controller.java:121)
    at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:149)
    at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:100)
    at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.java:253)
Caused by: java.util.regex.PatternSyntaxException: Unmatched closing ')' near index 17
@CountryCodes, ',')
where    nullif(data, '') is not null 

if object_id('tempdb..#AccountTypes') is not null drop table #AccountTypes
select    AccountType = convert(varchar(50), data)
into    #AccountTypes
from    dbo.Split(@
                 ^
    at java.util.regex.Pattern.error(Unknown Source)
    at java.util.regex.Pattern.compile(Unknown Source)
    at java.util.regex.Pattern.<init>(Unknown Source)
    at java.util.regex.Pattern.compile(Unknown Source)
    at java.lang.String.replaceFirst(Unknown Source)
    at com.salesforce.dataloader.dao.database.DatabaseContext.replaceSqlParams(DatabaseContext.java:134)
    at com.salesforce.dataloader.dao.database.DatabaseReader.setupQuery(DatabaseReader.java:123)
    at com.salesforce.dataloader.dao.database.DatabaseReader.open(DatabaseReader.java:111)
    ... 6 more
2017-06-21 01:45:37,892 ERROR [propertyMonthlyPerformanceData] progress.NihilistProgressAdapter doneError (NihilistProgressAdapter.java:58) - Unmatched closing ')' near index 17
@CountryCodes, ',')
where    nullif(data, '') is not null 

if object_id('tempdb..#AccountTypes') is not null drop table #AccountTypes
select    AccountType = convert(varchar(50), data)
into    #AccountTypes
from    dbo.Split(@
                 ^

 
Hello everyone,

I know this has been asked a few times but so far none of the solutions provided work.

I want to disable Chatter Answers which I enabled by mistake in Production.

I have deleted everything in this URL (https://help.salesforce.com/articleView?id=000181537&type=1) except for the classes and trigger.

That is the problem, I have tried with the Developer Console (not possible), with Eclipse (times out) and this is not in the sandbox.