Stefan Motz
asked on
Prevent inserting duplicate values in SQL Server database
Hi Experts,
I'm using the following code to insert values in my table:
In that case I would just like to update the value of the TimeStamp field.
How can I accomplish that on my classic ASP page?
Thank you for your help
I'm using the following code to insert values in my table:
INSERT INTO OT_Table (OT_Line, Emp_Id, Timestamp) VALUES ('"& strOT_Line &"','"& strEmp_Id &"','"& strTimeStamp &"')
I would like to prevent insertion if the OT_Line and Emp_Id are the same.In that case I would just like to update the value of the TimeStamp field.
How can I accomplish that on my classic ASP page?
Thank you for your help
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
IF NOT EXISTS(SELECT * FROM OTEWR WHERE OT_Line = '"& strOT_Line &"' AND Emp_Id = '"& strEmp_Id &"' ) BEGIN INSERT INTO OTEWR(OT_Line, Emp_Id, PersonAddedOn) VALUES ('"& strOT_Line &"', '"& strEmp_Id &"', '"& strPersonAddedOn &"') END