antonela (5/26/2014)
Do you know how can I do the same in sql server 2005?This functions properly only in sql server 2008 and 2012.
Heh... this is why you should always pick the correct forum to post your questions on. Because you posted on 2012 forum, people just naturally assume that your question is based on 2012 instead of 2005. Posting on the correct forum means that you'll get a compatible answer instead of having to wait for someone to rehash your code for an earilier version.
--Jeff Moden
Change is inevitable... Change for the better is not.