IS_OBJECTSIGNED (Transact-SQL)

指出物件是否由指定的憑證或非對稱金鑰所簽署。

主題連結圖示Transact-SQL 語法慣例

語法

IS_OBJECTSIGNED ( 
'OBJECT', @object_id, @class, @thumbprint
    ) 

引數

  • 'OBJECT'
    安全性實體類別的類型。

  • @object\_id
    正在測試之物件的 object_id。@object_id 的類型是 int。

  • @class
    物件的類別:

    • 'certificate'

    • 'asymmetric key'

    @class 是 sysname。

  • @thumbprint
    物件的 SHA 指模。@thumbprint 的類型是 varbinary(32)。

傳回的類型

int

備註

IS_OBJECTSIGNED 會傳回下列值。

傳回值

說明

0

未簽署物件。

1

已簽署物件。

NULL

物件無效。

權限

需要憑證或非對稱金鑰的 VIEW DEFINITION。

範例

A. 顯示資料庫的擴充屬性

下列範例會測試 master 資料庫中的 spt_fallback_db 資料表是否已由結構描述簽署憑證所簽署。

USE master
-- Declare a variable to hold a thumbprint and an object name
DECLARE @thumbprint varbinary(20), @objectname sysname;

-- Populate the thumbprint variable with the thumbprint of 
-- the master database schema signing certificate
SELECT @thumbprint = thumbprint 
FROM sys.certificates 
WHERE name LIKE '%SchemaSigningCertificate%';

-- Populate the object name variable with a table name in master
SELECT @objectname = 'spt_fallback_db';

-- Query to see if the table is signed by the thumbprint
SELECT @objectname AS [object name],
IS_OBJECTSIGNED(
'OBJECT', OBJECT_ID(@objectname), 'certificate', @thumbprint
) AS [Is the object signed?] ;