Results 1 to 3 of 3

Thread: CAST statement

  1. #1
    Join Date
    Nov 2005
    Location
    Wilmington DE
    Posts
    2

    Unanswered: CAST statement

    It must be something I'm overlooking but I keep getting an error message that this statement can't parse.

    UPDATE product SET supplier = LEFT(supplier,LEN(supplier-4)) + CAST( '2100' AS varchar(4)) WHERE actualid = 'IS2100-CO2-CO2-0-4-I'

    Any help would be greatly appreciated.

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    "LEFT(supplier,LEN(supplier-4))" should be "LEFT(supplier,LEN(supplier)-4)"

    D'oh!

    Also, you don't need to cast a numeric value that is already a string...
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Nov 2005
    Location
    Wilmington DE
    Posts
    2
    Quote Originally Posted by blindman
    "LEFT(supplier,LEN(supplier-4))" should be "LEFT(supplier,LEN(supplier)-4)"

    D'oh!

    Also, you don't need to cast a numeric value that is already a string...
    thanks for the help i realized after it was too late

Posting Permissions

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