John Miller
asked on
SQL Server
I have a SP in which i need to add one condition to check multiple databases by using sys.dm_database_encryption _keys table.
when encryption_state is 2 and percentage_completed is 0 in the results it should print. Below is my query
DECLARE @Test varchar(10)
SELECT @Test = Database_ID from
sys.dm_database_encryptio n_keys
WHERE Encryption_state = 2 and complete_percentage = 0
If (@test not NULL)
Begin
PRINT("ALTER DB NAme")
If i have multiple DB's which meets the about. It should PRINT multiple ALTER statements with DB Names
when encryption_state is 2 and percentage_completed is 0 in the results it should print. Below is my query
DECLARE @Test varchar(10)
SELECT @Test = Database_ID from
sys.dm_database_encryptio
WHERE Encryption_state = 2 and complete_percentage = 0
If (@test not NULL)
Begin
PRINT("ALTER DB NAme")
If i have multiple DB's which meets the about. It should PRINT multiple ALTER statements with DB Names
Please let us know your ultimate requirement. That way if possible and appropriate a better solution can be provided.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Open in new window