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.

View solution in original post

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.

View solution in original post

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
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

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 Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,643)