--
Determine whether the user has the access permission of the specified resource.
Use
[Master]
Go
Alter
Database
[Test] Set
Offline
;
--
Set strongswan
Go
Declare
@ Status bigint
Select
@ Status =
Status
From
Master.
DBO.
Sysdatabases where
Name
=
'Test'
Select
Has_dbaccess
(
'Test'
)
As
[
Availability
],
Databaseproperty
(
'Test'
,
'Issingleuser'
)
As
[
Dedicated or not
],
@ Status &
Ltrim
(
Str
(
Convert
(
Int
,
0x03e0 ),
11 ))
As
[
Data transmission is time-available
]
/*
Availability
Dedicated or not
Data transmission is time-available
0
0
512
*/
Go
Alter
Database
[Test] Set
Online
;
--
Set to Disabled
Go
Declare
@ Status bigint
Select
@ Status =
Status
From
Master.
DBO.
Sysdatabases where
Name
=
'Test'
Select
Has_dbaccess
(
'Test'
)
As
[
Availability
],
Databaseproperty
(
'Test'
,
'Issingleuser'
)
As
[
Dedicated or not
],
@ Status &
Ltrim
(
Str
(
Convert
(
Int
,
0x03e0 ),
11 ))
As
[
Data transmission is time-available
]
/*
Availability
Dedicated or not
Data transmission is time-available
1
0
0
*/