amachanic / sp_whoisactive

sp_whoisactive
GNU General Public License v3.0
1.13k stars 281 forks source link

Update sp_WhoIsActive.sql #72

Closed pelya1986 closed 2 years ago

pelya1986 commented 2 years ago

Add JobName if program_name like 'SQLAgent%'

erikdarlingdata commented 2 years ago

@pelya1986 thanks for the pull request, but cross-database queries like this don't work in Azure SQL DB. One of the goals of sp_WhoIsActive is to work there.

If I try to execute this code there, I get this error:

Msg 40515, Level 15, State 1, Line 16 Reference to database and/or server name in ‘msdb.dbo.sysjobs’ is not supported in this version of SQL Server.

erikdarlingdata commented 2 years ago

@pelya1986 If you'd like to submit a PR that's friendly to Azure SQL DB, we're more than willing to accept it. It'd just have to be some dynamic SQL to catch that up front so the proc doesn't error out.

pelya1986 commented 2 years ago

I understood. I write because in last versions don't work correctly @get_additional_info = 1 When I execute in result additional_info without parametr job_name

pelya1986 commented 2 years ago

don't work in v12.00-RC3

mfuller333 commented 2 years ago

Ok, I just tested it on the following SQL versions, and the [job_name] appears in addtional_info. What version of SQL Server are you running?

pelya1986 commented 2 years ago

sp_whoisactive version v12.00-RC3 Microsoft SQL Server 2019 (RTM-CU8-GDR) (KB4583459)

pelya1986 commented 2 years ago

I double-checked everything works

sorry

mfuller333 commented 2 years ago

@pelya1986 No worries, I had to install 2019 on my new notebook sooner or later anyways, investigating this possible bug just made that transition occur more rapidly. Which is a good thing.