IS_OBJECTSIGNED (Transact-SQL)

適用於:SQL ServerAzure SQL DatabaseAzure SQL 受控執行個體

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

Transact-SQL 語法慣例

Syntax

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

注意

若要檢視 SQL Server 2014 (12.x) 和舊版的 Transact-SQL 語法,請參閱 舊版檔

引數

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

@object_id
正在測試之物件的 object_id。 @object_id 的類型是 int

@class
物件的類別:

  • 'certificate'

  • 'asymmetric key'

@classsysname.

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

傳回的類型

int

備註

IS_OBJECTSIGNED 會傳回下列值。

傳回值 描述
NULL 物件未簽署,或物件無效。
0 物件已簽署,但簽章無效。
1 已簽署物件。

權限

需要憑證或非對稱金鑰的 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?] ;  

另請參閱

sys.fn_check_object_signatures (Transact-SQL)