cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rgparisoto
Level: Powered On

How to check if there's an item at Sql Server Table

Hi guys!

 

I'm importing an XML file that has a code.

I need to find at a SQL Server table if this code exist or not, if exist, do nothing, if do not exist, insert.

I made a SQL query to count if this code exist, but, when do not exist, I can't made any solution do continue the flow.

Has someone that made some solution like this?

 

Thank you,

Robson.

1 ACCEPTED SOLUTION

Accepted Solutions
barret
Level: Powered On

Re: How to check if there's an item at Sql Server Table

I would do this all in a single SQL statement. Something to the effect of:

 

IF NOT EXISTS (SELECT TOP 1 * FROM TABLENAME WHERE CODE = 'CODE')

INSERT INTO TABLENAME VALUES ('CODE')

 

No need to have multiple steps do anything else.

2 REPLIES 2
barret
Level: Powered On

Re: How to check if there's an item at Sql Server Table

I would do this all in a single SQL statement. Something to the effect of:

 

IF NOT EXISTS (SELECT TOP 1 * FROM TABLENAME WHERE CODE = 'CODE')

INSERT INTO TABLENAME VALUES ('CODE')

 

No need to have multiple steps do anything else.

rgparisoto
Level: Powered On

Re: How to check if there's an item at Sql Server Table

Thank you @barret !

I'll test.

Regards,

Robson.

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Users Online
Currently online: 268 members 5,055 guests
Recent signins:
Please welcome our newest community members: