Quantcast
Channel: THWACK: Message List
Viewing all articles
Browse latest Browse all 20396

Re: Re: SQL Auto close alert not passing ${DatabaseName} in alert message

$
0
0

This will not count properly when there is more than one database matching given criteria.

 

Try something like:

 

DECLARE @names VARCHAR(MAX)

SET @names = ''

 

SELECT @names = @names +  ', ' + name

FROM sys.databases WHERE is_auto_close_on = 1

 

IF LEN(@names) > 0

SET @names = 'Autoclose databases: ' + RIGHT(@names, LEN(@names) - 2)

 

SELECT COUNT(*) as [cnt], @names as [msg]

FROM sys.databases WHERE is_auto_close_on = 1


Viewing all articles
Browse latest Browse all 20396

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>