<cffunction name="getConnectionsNumb" output="No" returntype="any" description="returns the number of connections to the server and displays the originating IP address and port of each connection.">
<cfset var getConnectionsNumb = "">
<cfquery name="getConnectionsNumb" datasource="yourdsn" username="youruserName" password="yourpasswd">
SELECT session_id, connect_time, net_transport, num_reads, num_writes, last_read, last_write
, client_net_address, client_tcp_port, local_net_address, local_tcp_port
FROM sys.dm_exec_connections;
</cfquery>
<cfreturn getConnectionsNumb>
</cffunction>
Example of usage:
<cfdump var="#getConnectionsNumb()#">