2 Replies Latest reply on Jul 2, 2007 8:21 AM by Newsgroup_User

    Any SQL geniuses out there?

    Level 7
      I am attempting to fix a SQL error that was given to me a little outside of
      my experience. Its a CASE statement that is trying to concatenate to a
      string if the conditions are met, but I am getting this error:

      Cannot use empty object or column names. Use a single space if necessary.

      This is the code. Any glaring error?

      case
      when academic.expect_grad_mm<>''
      and academic.expect_grad_yyyy<>''
      then academic.expect_grad_mm+'/31/'+academic.expect_grad_yyyy
      else ""
      end

      All the columns are there and this supposedly worked a couple months ago.

      Thanks


        • 1. Re: Any SQL geniuses out there?
          Level 7
          Wally Kolcz wrote:
          > I am attempting to fix a SQL error that was given to me a little outside of
          > my experience. Its a CASE statement that is trying to concatenate to a
          > string if the conditions are met, but I am getting this error:
          >
          > Cannot use empty object or column names. Use a single space if necessary.
          >
          > This is the code. Any glaring error?
          >
          > case
          > when academic.expect_grad_mm<>''
          > and academic.expect_grad_yyyy<>''
          > then academic.expect_grad_mm+'/31/'+academic.expect_grad_yyyy
          > else ""
          > end
          >
          > All the columns are there and this supposedly worked a couple months ago.
          >
          > Thanks
          >
          >


          A bit of a guess here, but this is what caught my eye.
          'Cannot use empty object or column names. Use a single space if necessary.'
          AND
          'else ""'

          I would hazard a guess that you need to return something other then an
          empty string in the else clause.

          • 2. Re: Any SQL geniuses out there?
            Level 7
            Yeah, got the same thing and it worked. Thanks