Val() is not a recognized function name?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • venuvasavi
    New Member
    • Jan 2012
    • 13

    Val() is not a recognized function name?

    Hi,

    I am executing, update query as
    Code:
    Update taans set pbno='OLD' & pbno where  val(right(itemcode,5))<2774;
    , while executing it gives error as "Val() is not a recognized function name" how can over come this error? Is any predefined method available?
    my item code is like 'V00121".


    Thanks in Advance,
    VASAVIVENU.
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Use CAST or CONVERT functions instead.

    Happy Coding!!!


    ~~ CK

    Comment

    • venuvasavi
      New Member
      • Jan 2012
      • 13

      #3
      CAST or CONVERT these two not working.
      when using cast it gives error as "Server: Msg 403, Level 16, State 1, Line 1
      Invalid operator for data type. Operator equals boolean AND, type equals nvarchar."
      Thanks in Advance,

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        That's because the function takes an additional parameter stating the data type you wish to CAST or CONVERT to. Also, why are you using the & operator? It's a boolean operator. SQL is not VB, that's not a concatenation operator. The concatentaion operator in SQL is +

        Comment

        Working...