Click here to Skip to main content
15,886,873 members

Comments by Member 11265547 (Top 11 by date)

Member 11265547 9-Feb-15 4:45am View    
finally found out how to do it, yes there was a trigger (sorry wasn't aware there was one) so I added the update to the trigger and it works great now.

Thanks everyone for your help.
and sorry I'm fairly new to SQL but its part of my job now so I appreciate the help.
Member 11265547 9-Feb-15 3:08am View    
The reason I need to change the code before I delete it is because it is causing problems with some software that imports into the database. it is importing the data into the deleted products when there is a duplicate product code instead of the non deleted products.
Member 11265547 6-Feb-15 11:23am View    
this does work but I need it to do both things
Member 11265547 6-Feb-15 10:11am View    
Ok so I tried changing the error message to see if it shows up when i try to delete a product with stock and it did so this is the right procedure!

so maybe i'm putting the code into the wrong part of the code where should I insert (UPDATE Product SET ProductCode = 'D_' + ProductCode WHERE ProductID = @ProductID) in to the procedure
Member 11265547 6-Feb-15 10:02am View    
so 'DELETE FROM Product WHERE ProductID = @ProductID' would delete the product from the table completely?

I thought there was another procedure that handles what happens when a product is deleted but I've not found any yet still looking though, there's 716 to look through, loosing the will!