hello!
im new to sql... what i'm trying to do is catch the error on insert or update statment of sql.. sound simple but please..
this is the sample table design...
tbl_Customer
CustomerID int(4) Primary AutoIncrement
CustomerCode nvarchar(25)
CustomerName nvarchar(25)
..
..
Deleted bit(1)
what i'm trying to do is when a record is deleted, it's not actually deleted
in the table but only marked 1 (true) the Deleted field.. because i don't want
to lose the relationship...
it's easy to do this on insert statement like this..
Create Procedure InsertCustomer(@.param1 ...) AS
IF NOT EXIST (SELECT * FROM tbl_Customer WHERE DELETED = 0) THEN
// do insert statement here
ELSE
// Do nothing
GO
this is also easy if i create a index constraints on the table.. but this will violate my design idea..
so anybody can help me to create the procedure in update statement and insert statementcatch what error?
can you explain what you want to do here?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment