Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert command

Status
Not open for further replies.

nisha23

Programmer
Sep 23, 2003
19
US
I am doing simple Insert command
Insert into table1
(fld1, fld2, fld3, fld4)
values
(1,2,3,4)

Now the problem is if value of fld4 is -1 then I want to insert -1. But if it is not -1 then I want to check in another table like table2 before insertion. If value is not present then the command should fail and return error.

I can do this problem with stored procedures but I don't want to change my code in VC++. So Please suggest if possible by one command or two commands.
 

Create a BEFORE INSERT trigger.



----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top