SQL Server元数据的管理与应用

复制 CREATE PROCEDURE [dbo].[pAdd_Application] @ServerName varchar(50),元用 @DatabaseName varchar(100), @ApplicationName varchar(100) AS --Add any new databases created, but not recorded in the repository, to the repository UPDATE dbo.Database_Applications SET ApplicationName = @ApplicationName WHERE ServerName = @ServerName AND DatabaseName = @DatabaseName AND ApplicationName IS NULL --Determine if there is already an application for this database in the repository, if not, then add it IF (SELECT COUNT(*) FROM dbo.Applications WHERE ApplicationName = @ApplicationName) = 0 BEGIN INSERT INTO dbo.Applications (ApplicationName) VALUES (@ApplicationName) PRINT Added new Application: + @ApplicationName + to Applications table SELECT * FROM dbo.Applications WHERE ApplicationName = @ApplicationName END --List the new record in the repository SELECT ServerName, DatabaseName, ApplicationName FROM dbo.Database_Applications WHERE ServerName = @ServerName AND DatabaseName = @DatabaseName AND ApplicationName = @ApplicationName1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.
本文地址:http://www.bzuk.cn/news/19f6799913.html
版权声明
本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。