tried your code, and it doesn't work on all situations;
it found SQL2005 as version 611 just fine, but only that for me.
For others(i have all on my dev machine), it returned:
zero for a SQL2008 database with version 655,
zero for 2008R2 database with version 661
zero for 2012 database with version 706
i didn't have a 2000 database backup to test with.
--help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!