User Profile

Collapse

Profile Sidebar

Collapse
kate s
kate s
Last Activity: Dec 5 '08, 11:38 AM
Joined: Nov 24 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • kate s
    replied to Trigger for preventing duplicates.
    Hi Atli, I cam up with the following code:

    Code:
    DELIMITER //
    
    CREATE TRIGGER employee_tg 
    BEFORE INSERT ON employee
    FOR EACH ROW
    
    BEGIN
    
    
    IF new.employee_id = employee_id
    AND new.place = place
    THEN
    SET @messsage = 'duplicate employee_id and place';
    
    ELSEIF new.employee_id = new.employee_id
    AND new.place = new.place
    THEN
    ...
    See more | Go to post

    Leave a comment:


  • kate s
    replied to Trigger for preventing duplicates.
    Thank you for your assistance!

    The way you created the UniqueTest table and inserted the values and MYSQL complained with an error is exactly what I need!! But I want this using a Trigger.

    I still have problems in the code I provided in post#1. I fixed the errors you stated but it still complains with an error.

    Do you know of how to create the trigger after the 'IF' statement and assign the error messages...
    See more | Go to post

    Leave a comment:


  • kate s
    replied to Trigger for preventing duplicates.
    Hi, I was researching through google and I found the RAISEERROR function to display the error message. I thought it will work for MYSQL. How can I display the error message then?

    I have an employee table with employee_id and place fields. The trigger is activated by the Before Insert event.

    The purpose of my trigger is prevent duplication in my table. When there's a duplication of employee_id and place the trigger generates...
    See more | Go to post

    Leave a comment:


  • kate s
    started a topic Trigger for preventing duplicates.

    Trigger for preventing duplicates.

    Im creating an employee database for TAFE. I have an employee table with employee_id and place fields.

    The trigger is activated by the Before Insert event.

    When there's a duplication of employee_id and place the trigger generates a message. For example if a new inserted row has employee_id 20 place 6, and there is a row with employee_id 20 and place 6 already existed in the Employee table, the trigger generates a message:...
    See more | Go to post
    Last edited by Atli; Dec 4 '08, 02:22 PM. Reason: Removed the "Please help" from the title. It just gets in the way.

  • kate s
    started a topic Read from TXT file - Please Help

    Read from TXT file - Please Help

    I have an employee txt file. It looks like this:

    Number / Name / Qualifications /
    007 / Tim / Diploma in Business
    005 / Tom / IT project management
    006 / Marry / Business Admin
    008 / Larry / IT Support

    Ill open the text file first: text_file = open ("employee.t xt, "r")

    The user will enter the employee number and python will read first line and display name and...
    See more | Go to post
No activity results to display
Show More
Working...