Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

old value

WolfsbaneWolfsbane Member Posts: 12
I am attempting to translate Oracle SQL to SQL Server SQL. In the Oracle script there is a standard Oracle reference to a deleted vale in a trigger. The column is referenced ":old.Query_id". it is used in a WHERE statement this way " WHERE Query_Table_Column_Hits.Quert_ID = :old.Query_Id" I get a syntax error at the ":" so I am assuming that the ":old" is not a good reference to the deleted value. What would be a good reference?

Comments

  • GideonOmegaGideonOmega Member Posts: 617
    [b][red]This message was edited by GideonOmega at 2003-11-6 11:59:47[/red][/b][hr]
    : I am attempting to translate Oracle SQL to SQL Server SQL. In the Oracle script there is a standard Oracle reference to a deleted vale in a trigger. The column is referenced ":old.Query_id". it is used in a WHERE statement this way " WHERE Query_Table_Column_Hits.Quert_ID = :old.Query_Id" I get a syntax error at the ":" so I am assuming that the ":old" is not a good reference to the deleted value. What would be a good reference?
    :
    in the trigger you refference the deleted table, it will contain the last record that was updated or deleted, I belive the field names are the same in the deleted table as the table that the record was deleted or updated from.

    ...just to clarify the to refference the deleted table you simply use select whatever from DELETED, I belive

    Hope this helps.


    [blue]
    C:Dos
    C:Dos Run
    Run Dos Run
    [/blue]



  • WolfsbaneWolfsbane Member Posts: 12
    Thanks this got me through the situation. It worked like a champ.
    : [b][red]This message was edited by GideonOmega at 2003-11-6 11:59:47[/red][/b][hr]
    : : I am attempting to translate Oracle SQL to SQL Server SQL. In the Oracle script there is a standard Oracle reference to a deleted vale in a trigger. The column is referenced ":old.Query_id". it is used in a WHERE statement this way " WHERE Query_Table_Column_Hits.Quert_ID = :old.Query_Id" I get a syntax error at the ":" so I am assuming that the ":old" is not a good reference to the deleted value. What would be a good reference?
    : :
    : in the trigger you refference the deleted table, it will contain the last record that was updated or deleted, I belive the field names are the same in the deleted table as the table that the record was deleted or updated from.
    :
    : ...just to clarify the to refference the deleted table you simply use select whatever from DELETED, I belive
    :
    : Hope this helps.
    :
    :
    : [blue]
    : C:Dos
    : C:Dos Run
    : Run Dos Run
    : [/blue]
    :
    :
    :
    :

  • GideonOmegaGideonOmega Member Posts: 617
    : Thanks this got me through the situation. It worked like a champ.


    Glad I could help.

    [blue]
    C:Dos
    C:Dos Run
    Run Dos Run
    [/blue]

Sign In or Register to comment.