Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2002
    Posts
    30

    Unanswered: Do YOU see the syntax error?

    Hey All,
    I get error 170 on the select line(syntax) saying there is an error around the '='. To me this looks good, I must be missing something obvious - a second pair of eyes and maybe a working brain would really help me out - Thanks

    DECLARE @CylinderID int
    DECLARE @LocationID int
    DECLARE @CurrentLocID int


    SELECT Distinct bl.[Date], i.BottleID = @CylinderID, i.Loc_ID = @LocationID
    FROM [Bottle Location] bl, inserted i
    WHERE bl.BottleID = i.BottleID
    AND bl.[Date] = (SELECT max(bl.[DATE])
    From [Bottle Location] bl, inserted i
    WHERE bl.BottleID = i.BottleID)

  2. #2
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809

    Re: Do YOU see the syntax error?

    could you state exactly what are you trying to return here?

    SELECT Distinct bl.[Date], i.BottleID = @CylinderID, i.Loc_ID = @LocationID

    I get the feeling you are trying to return all rows where i.BottleID contains the same value as @CylinderID and i.Loc_ID contains the same value as @LocationID....
    Paul Young
    (Knowledge is power! Get some!)

  3. #3
    Join Date
    Jul 2002
    Posts
    30
    Hey - I was trying to assign the value to the variables based on the most recent date in the location table for that cylinder. However, you were right, I wasn't writing it correctly. I re-wrote it and the syntax is good now. I'd still be sitting here though, so thanks for the comments. A second pair of eyes is sometimes the greatest help!

  4. #4
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    Glad you got it straightened out!
    Paul Young
    (Knowledge is power! Get some!)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •