Καλώς ορίσατε στο dotNETZone.gr - Σύνδεση | Εγγραφή | Βοήθεια
σε

 

Αρχική σελίδα Ιστολόγια Συζητήσεις Εκθέσεις Φωτογραφιών Αρχειοθήκες

'CREATE TRIGGER' must be the first statement in a query batch

Îåêßíçóå áðü ôï ìÝëïò IXC. Τελευταία δημοσίευση από το μέλος IXC στις 13-07-2007, 15:48. Υπάρχουν 1 απαντήσεις.
Ταξινόμηση Δημοσιεύσεων: Προηγούμενο Επόμενο
  •  13-07-2007, 13:32 33572

    'CREATE TRIGGER' must be the first statement in a query batch

    Γειά σας

    Προσπαθώ να εκτελέσω το παρακάτω Τ-SQL στην SQL 2000 DB και παίρνω αυτό το μήνυμα :

    [Microsoft][ODBC SQL Server Driver][SQL Server]'CREATE TRIGGER' must be the first statement in a query batch.

     

    CREATE TRIGGER [trg_UpdateVoteCountOnDelete] ON [dbo].[PollResults] AFTER DELETE

    AS

    DECLARE @PollId int,

    @AnswerId int

    BEGIN

    select @PollId=pollid, @AnswerId=pollchoice from deleted

    update pollanswers

    set answercount=(select count(*) from pollresults where pollid=@PollId and pollchoice=@AnswerId) where pollid=@PollId and answerid=@AnswerId

    update pollquestions

    set answercount=(select count(*) from pollresults where pollid=@PollId) where pollid=@PollId

    END

    RETURN

     

     

    Για ποιό λόγο ξέρει κάποιος;   

  •  13-07-2007, 15:48 33576 σε απάντηση της 33572

    Απ: 'CREATE TRIGGER' must be the first statement in a query batch

    Μετά απο κάμποσο ψάξιμο στο Διαδίκτυο βρήκα τι έφταιγε.

     

    The CREATE TRIGGER Clause
    Trigger creation begins with the CREATE TRIGGER clause followed by a trigger
    name. Triggers do not allow specifying the database name as a prefix to the object
    name. Therefore, select the database with the USE database_name clause and the
    GO keyword before creating a trigger. GO is specified because CREATE TRIGGER
    must be the first statement in a query batch.

     

    Πρόσθεσα το GΟ και δούλεψε άψογα.

Προβολή Τροφοδοσίας RSS με μορφή XML
Με χρήση του Community Server (Commercial Edition), από την Telligent Systems