UFN_AUDITENABLED
Return
| Return Type |
|---|
| bit |
Parameters
| Parameter | Parameter Type | Mode | Description |
|---|---|---|---|
| @TABLENAME | nvarchar(128) | IN |
Definition
Copy
CREATE function dbo.UFN_AUDITENABLED(@TABLENAME nvarchar(128)) returns bit with execute as caller
as
/*
Returns 1 (true) if the audit is explicitly enabled on the table
Returns 0 (false) if the audit is not explicitly enabled on the table
*/
/*
pdg 11.18.2010 BB 2.9 (Q1 2011) release:
Changing default behavior of audit to be OFF by default unless explicitly enabled
*/
begin
declare @value int;
select @value = cast(ep.value as int) from sys.extended_properties as ep where ep.class=1 and ep.minor_id=0 and ep.major_id=OBJECT_ID(@TABLENAME) and ep.name='BB_Audit';
-- by default, auditing is disabled, so if we find no property, then return 0
select @value = case when @value is null then 0 else @value end;
return @value;
end