Invalid Column Name

  • When I run this query I got an error 'Invalid column name 'Gender' '

    SELECT ROW_NUMBER() OVER( ORDER BY gender) ROWID,

    Gender = P.Fsex,

    MartialTypeID = P.Frelation,

    Lastvisit = P.Flastvisit,

    NxtVisit = P.Fnextvisit,

    LastTxNumber = P.Flasttxno,

    OldAcct = P.fOldAcct,

    ClaimGroup = P.fClaimGroup,

    ConsultDate = P.fConsultDate,

    usedby=P.Fusedby,

    IsDeleted = P.Fdelete,

    CreatedDate = P.Fwhen,

    TrojanId = P.fTrojanId,

    PreferMtd =P .fPreferMtd,

    AllowText = P.fAllowText,

    KodakID = P.fKodak,

    TempHold = P.fTempHold,

    TempBy = P.fTempBy,

    TempWhen = P.fTempWhen,

    TOD = P.fTOD

    into #temp

    From WCDentalSQL_VAL..Patient P

    _______________________________________________________________
    To get quick answer follow this link:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • Because it's not yet exist to be used in OVER (ORDER BY ...)

    Change it to:

    .. ROW_NUMBER() OVER( ORDER BY P.Fsex) ROWID,

    ...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply