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 the query i will provide.
Microsoft SQL ServerSQL
Last Comment
Vitor Montalvão
8/22/2022 - Mon
Nitin Sontakke
So? Where are you stuck?
Have you tried something?
John Miller
ASKER
I tried this
DECLARE @Test varchar(10)
SELECT @Test = Database_ID from
sys.dm_database_encryption_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.
Have you tried something?