cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper V
Helper V

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
Advocate II
Advocate II

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
Advocate II
Advocate II

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

Thank you @barret !

I'll test.

Regards,

Robson.

Helpful resources

Announcements
PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (7,506)