Sql Stored Procedure

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mahesh123
    New Member
    • Oct 2007
    • 64

    Sql Stored Procedure

    Hi,

    I have to write stored procedure for delete
    i am using SQL Server 2005 as my database.
    I can delete directly by writing stored procedures simply to delete.But i have to check the condition to find weather the ID i am going to delete is used as Foreign key in another table.If it is used it should not be deleted.

    Can anyone help me.
    Thank you
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    So create your procedure and have it take the ID as a parameter.
    Check to see if the record for the ID has that value that could be a foreign key, if it doesn't delete it.

    Comment

    Working...