Its very usefull query
I had create stored procedure for it with inputdate parameter
I'm not a sysadmin, more of a developer and data analyst, so I usually write my system table and DMV queries as scripts (as opposed to stored procedures), so I can run them on a server where I have been granted datareader access but not permission to create objects.
"Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho