https://www.techrepublic.com.com/5138-9592-5783491.html
The stored procedure outlined in the download is fairly detailed. [b]Do you have a better approach or possibly a way to improve the overall performance of the query?[/b]