Answered by:
Must declare the scalar variable problem

Question
-
Dear all,I keep having this message "Must declare the scalar variable "@dataCreated".I hope someone can help me out.ThanksThere is the coding
Create TRIGGER checkNotMoreThanSixdayss On Booking AFTER INSERT, UPDATE, DELETE AS BEGIN DECLARE @dateCreated DATE, DECLARE @bookingInserted VARCHAR(6) SELECT @bookingInserted = bookingID FROM inserted; SELECT @dataCreated = dateCreated FROM Booking WHERE bookingID = @bookingInserted; IF DATEDIFF(dd, @dateCreated,)> 6 ROLLBACK TRANSACTION END
- Edited by JonKho Saturday, February 6, 2010 11:54 PM
Saturday, February 6, 2010 3:12 PM
Answers
-
Dude, you didn't declare this variable. :)
you declared '@dateCreated' and are calling as '@dataCreated'...
- Proposed as answer by Gláucio Oliveira Saturday, February 6, 2010 3:28 PM
- Marked as answer by JonKho Saturday, February 6, 2010 4:03 PM
Saturday, February 6, 2010 3:26 PM
All replies
-
Dude, you didn't declare this variable. :)
you declared '@dateCreated' and are calling as '@dataCreated'...
- Proposed as answer by Gláucio Oliveira Saturday, February 6, 2010 3:28 PM
- Marked as answer by JonKho Saturday, February 6, 2010 4:03 PM
Saturday, February 6, 2010 3:26 PM -
Dude, you didn't declare this variable. :)
you declared '@dateCreated' and are calling as '@dataCreated'...
UP
More: blog.csdn.net/happyflystoneSaturday, February 6, 2010 3:28 PM -
Dude, you didn't declare this variable. :)
Hi and thanks for replying.
you declared '@dateCreated' and are calling as '@dataCreated'...
But i thought i have declared it here?DECLARE @dateCreated DATE, @bookingDate DATE
strangely it works for @bookingdate..
thanks
Saturday, February 6, 2010 3:43 PM -
Dear all... thanks for spotting the dumb mistake..I placed dataCreated not dateCreated...once again.. thanks alot..Saturday, February 6, 2010 4:03 PM