May 23, 2017 at 5:14 pm
Is there a query I can find out how many users currently from a .net application to connect to a SQL database?
Thanks,
May 24, 2017 at 3:30 am
sqlfriends - Tuesday, May 23, 2017 5:14 PMIs there a query I can find out how many users currently from a .net application to connect to a SQL database?Thanks,
Try this
select count(*) from sys.dm_exec_sessions where database_id=db_id('db_name') and program_name='.Net SqlClient Data Provider'
May 24, 2017 at 6:05 am
VastSQL - Wednesday, May 24, 2017 3:30 AMsqlfriends - Tuesday, May 23, 2017 5:14 PMIs there a query I can find out how many users currently from a .net application to connect to a SQL database?Thanks,
Try this
select count(*) from sys.dm_exec_sessions where database_id=db_id('db_name') and program_name='.Net SqlClient Data Provider'
Which will work as long as the program_name is filled in by the connection string. If it's not, you may not see this. It's not a required property in the connection strings.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
May 24, 2017 at 10:05 am
Currently it returns 0. Possibly nobody is using the site.
I believe there is no way to find out the connections at a particular past time.
THanks
May 24, 2017 at 10:10 am
sqlfriends - Wednesday, May 24, 2017 10:05 AMCurrently it returns 0. Possibly nobody is using the site.
I believe there is no way to find out the connections at a particular past time.THanks
No. There's nothing that logs connections automatically. You can use extended events to do that, but you have to set it up in order to have the information available.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply