Get current connection protocol in SQL 2000 - sql-server

I'm currently using SQL 2000 (it's a vendor server - don't ask...), and I'm wondering if there's a way to detect the connection protocol of connected clients. For SQL 2005+, I use:
select net_transport from sys.dm_exec_connections
where session_id = ##spid
But SQL2000 lacks this dynamic view. Anybody know the equivalent function on SQL2000?

SELECT net_library FROM sysprocesses WHERE spid = ##SPID
You can also sys.sysprocesses in SQL Server 2005/2008. It may be deprecated but there is no equivalent in after SQL 2000 for functionality, says MS Connect 144515

Related

Cursor support is not an implemented feature for SQL Server Parallel DataWarehousing TDS endpoint

I created linked server to Azure synapse SQL pool (dedicated pool) at my on-prem SQL Server named (SynapseSql - linked server name)
When I try to run this query:
INSERT INTO [SynapseSQL].[DW].[dbo].[t1] ([col1]) VALUES (1)
It is throwing me an error:
Msg 46706, Level 16, State 1, Line 1
Cursor support is not an implemented feature for SQL Server Parallel DataWarehousing TDS endpoint.
Is that mean we cannot insert/update/delete data using parallel query in linked server to synapse?
Could anybody help me to use parallel queries in my SProc`s for dedicated SQL pool?
Thanks!
The functionalities of a normal SQL Server or SQL Azure database are not supported by Microsoft Azure Data Warehouse. Server-side cursors, for example, are not supported by Azure Data Warehouse. When connecting to Azure Data Warehouse using a driver like the Microsoft SQL Server JDBC driver or the jTDS JDBC driver, the driver must be set to not utilise cursors, otherwise problems will occur on certain queries.
As the Linked Servers, they allow the instance in which they are created to read data from external data sources as well as execute commands against remote database servers.
As a workaround this could be used:
EXEC ('INSERT INTO dbo.t1 VALUES(1)') at yourLinkedServer;
Or
WITH t1 as ( select * FROM schema.table ) select * FROM t1
This is the Original Post describes the workaround and the limitation.

How to find all the session for particular plan_handle or sql_hash in SQL Server

How to find all the session for particular plan_handle or sql_hash in SQL Server?

Find out port of database running in SQL Server 2016

I am wondering how to find out at which port a database running locally in SQL Server 2016 is accepting requests.
The Problem is that the database was set up by a partner, but the port wasn't documented. I tried the default port of 1433, but that did not work.
I also tried using SQL Server Management Studio, but did not find what I was looking for.
You can use this query I have been using:
SELECT DISTINCT local_net_address, local_tcp_port
FROM sys.dm_exec_connections
WHERE local_net_address IS NOT NULL
OR
-- Execute below script if SQL Server is configured with dynamic port number
SELECT local_tcp_port
FROM sys.dm_exec_connections
WHERE session_id = ##SPID
OR
-- Execute below script if SQL Server is configured with static port number
DECLARE #portNo NVARCHAR(10)
EXEC xp_instance_regread
#rootkey = 'HKEY_LOCAL_MACHINE',
#key =
'Software\Microsoft\Microsoft SQL Server\MSSQLServer\SuperSocketNetLib\Tcp\IpAll',
#value_name = 'TcpPort',
#value = #portNo OUTPUT
SELECT [PortNumber] = #portNo
At least one of these will work for you.

Quantity of active connections in SQL Server 2014

How can I monitor the quantity of active connections in SQL Server 2014 using SQL Server 2014 Management Studio?
SELECT * FROM sys.dm_exec_sessions
If active connections means those connections which are executing something right now then one solution is
sys.dm_exec_requests
https://msdn.microsoft.com/en-us/library/ms177648.aspx
"Returns information about each request that is executing within SQL Server."
To get count of active connections we can use:
SELECT COUNT(*)
FROM sys.dm_exec_requests
--Where status = 'Running'
Note: executing requests/statements can have a status. Please see doc for sys.dm_exec_requests.status column.

tsql to know when sql service was installed

Using Tsql, how can I find out when MS SQL server was installed?
The NT AUTHORITY\SYSTEM login is created when you install SQL Server, so:
SELECT createdate
FROM sys.syslogins
WHERE name = 'NT AUTHORITY\SYSTEM'
This will return an incorrect result however if you've ever restored the Master database.
It looks like the first 100 principal_id values are reserved in sys.server_principals (SQL Server 2005+). Based on what I see in one of my sys.server_principals (SQL Server 2005, SP3), I'd try this:
SELECT MIN(create_date) FROM sys.server_principals WHERE principal_id > 100

Resources