Before creating and executing sp_vdevno, note the following:
Create sp_vdevno in the master database.
If you change the name of the procedure, make sure the new procedure name begins with “sp_”.
Review the Transact-SQL User's Guide explanation of how to create and execute stored procedures.
CREATE PROC sp_vdevno AS SELECT vdevno = low/power(2,24), name, status from master..sysdevices where cntrltype = 0