Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2011
    Posts
    24

    Unanswered: why isnt this query working??

    select
    CASE
    when Name != ' '
    Then 'N'
    Else delete from table where Name=' '
    End

    from table

    im trying to delete a row from table where name is blank
    thanks for your help

  2. #2
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    CASE in SQL only returns a value, it does not do an action.

  3. #3
    Join Date
    Nov 2011
    Posts
    24

    Re:

    Quote Originally Posted by MCrowley View Post
    CASE in SQL only returns a value, it does not do an action.
    Thanks MCrowley
    so how do i perform this action?

  4. #4
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Why are you using SELECT for a DELETE statement?
    If it's not practically useful, then it's practically useless.

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

  5. #5
    Join Date
    Nov 2011
    Posts
    24

    Re:

    new at this

  6. #6
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    It depends. Are you trying to return a result, or are you deleting a row based on some criteria?

Posting Permissions

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