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
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

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 (76,153)