Those warnings do not apply to the code snippet you supplied
Now, back to your original question. Define "doesn't work". How do you know it is not working? What kind of debugging have you done? Are you sure it is even executing? Is the SQL server accepting your query and executing it without any errors?
I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).