Delete row if PK matches value with messages

Hello, was wondering if you folks know how to do what the title says? I'm looking for a specific int value and if it matches, delete the rows with it. I have the delete from table code working so far but it doesn't return an error if there's no match.

Thanks again.

Posted Nov 5, 2018, 8:46 PM UTC

16
Bitter_Bridge•

A stored procedure could handle that

2
CanadianCoder77OP•

Excellent got that done, so I'm guessing I can put an if else statement in there to check if the value is found = select "found"; else select "not found";

1
Bitter_Bridge•

Absolutely, you can write multiple statements, have conditionals, create temp tables, any number of functions. They are extremely handy, and you can make the output of a SP anything you want.

2
TashaEli•

Do you have documentation on what a stored procedure is and how to use it? In my current position, I'm not allowed to do much actual data manipulation, including creating and dropping tables

1
Bitter_Bridge•

Can you post the queries that you’ve written so far? I may have an easier way to do this.

1