Looks good but how do you go about getting the same information for all databases on a SQL instance.
i.e I'm trying to check when a database is about to auto-extend and I just want the available space for DB1, DB2 etc.
The USE command doesnt seem to permit the construct
USE @dbName. You have to implicitly specify the database i.e USE "DB1"
KR
Ian