have you tested this query in the sql management studio? does it work?