代码如下:use master declare DbName varchar(60) declare BackSql varchar(1000) declare myCursor cursor for SELECT [name] FROM SYSDATABASES where [name] not in (‘master’,’model’,’msdb’,’tempdb’) order by [name] open myCursor fetch next from myCursor into Db