Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Sam1988
Contributor
Contributor

Need help to fetch complex data from MSSql server to Salesforce

Hi Everyone. I am very new to Talend. I want to fetch complex data from MSSql server to Salesforce.

My SQL Script looks like below.

 

DECLARE @ServiceUser TABLE 

(   CompanyID int,

    NRC Varchar(100),

    Name Varchar(200),

    ServicPortfolioUserId int, 

    SalesPerson1Name Varchar(50),   

    SalesPerson2PortfolioUserId int, 

    SalesPerson2Name Varchar(50)

)

 

INSERT INTO @ServiceUser 

SELECT cc.ID, cc.NRC, cc.Name, appSales1.ID, AppSales1.FullName, NULL, NULL

FROM ClientServiceUser csa

INNER JOIN PortfolioUser appSales1 ON appSales1.ID = csa.SalesPersonPortfolioUserID AND csa.SalesOrder=1

INNER JOIN ClientCompany cc ON cc.ID = csa.ClientCompanyID

 

UPDATE @ServiceUser

SET SalesPerson2PortfolioUserId = csa.SalesPersonPortfolioUserID

FROM ClientServiceUser csa 

WHERE csa.ClientCompanyID = CompanyID

AND csa.SalesOrder=2

 

UPDATE @ServiceUser

SET SalesPerson2Name = a.FullName

FROM PortfolioUser a 

WHERE a.ID = SalesPerson2PortfolioUserId

 

SELECT * FROM ClientCompany cc

LEFT OUTER JOIN @ServiceUser sa ON sa.CompanyID = cc.ID

INNER JOIN Compliance ccc ON ccc.CompanyID = cc.ID 

LEFT OUTER JOIN CompanyType cct ON cct.ID = cc.CompanyTypeID

LEFT OUTER JOIN CompanyCategory ccat ON ccat.ID = cc.CompanyCategoryID

INNER JOIN CompanyStatus ccs ON ccs.ID = cc.CompanyStatusID

LEFT OUTER JOIN PortfolioUser appDealer ON appDealer.ID = cc.DealerPortfolioUserID

LEFT OUTER JOIN CompanyDivision cDiv ON cDiv.ID = ccc.CompanyDivisionID

How to run this script and fetch the data? Can anyone please help me?

Labels (4)
2 Replies
Sam1988
Contributor
Contributor
Author

Can any expert please help me on this?

Anonymous
Not applicable

Hi

Learn the basic MSSQL server components such as tMssqlInput, tMssqlOutput, and create a job to achieve the requirement using component instead of script.

tMssqlInput: run a select statement to read data from DB.

tMSSQLOutput: insert or update data into DB.

 

Regards

Shong