T-SQL Query to find IP Address of SQL Server | SansSQL

Saturday, March 23, 2013

T-SQL Query to find IP Address of SQL Server

Here is a handy T-SQL script to find the IP Address of the SQL Server you are connected to.

SELECT CONNECTIONPROPERTY('local_net_address') AS [IP Address Of SQL Server]

SELECT SERVERPROPERTY('ComputerNamePhysicalNetBIOS') [Machine Name]
   ,SERVERPROPERTY('InstanceName') AS [Instance Name]
   ,LOCAL_NET_ADDRESS AS [IP Address Of SQL Server]
   ,CLIENT_NET_ADDRESS AS [IP Address Of Client]
 FROM SYS.DM_EXEC_CONNECTIONS 
 WHERE SESSION_ID = @@SPID

29 comments:

Kay bee said...

Thnx a lot.. god bless...

thongchai.jindatam said...

SELECT CLIENT_NET_ADDRESS AS [IP Address Of Client]
FROM SYS.DM_EXEC_CONNECTIONS
WHERE SESSION_ID = @@SPID


RESULT >>> local machine

Help Me plese

Sandesh Segu said...

You have to run this query from a remote PC to get IP address. If you are running from the same server as SQL server then the query returns Local Machine.

Unknown said...

Computer devices in the network configuration like PCs, printers, scanners and other machines are assigned with IP addresses. UK IP Restriction

SATEESH said...

i am unable to run this query in my sql, What are the permissions to perform this action.

Muhammad Hassan said...

Excellent website! I adore how it is easy on my eyes it is. I am questioning how I might be notified whenever a new post has been made. Looking for more new updates. Have a great day! 192.168

mark johnson said...

Much obliged to you again for all the learning you distribute,Good post. I was exceptionally intrigued by the article, it's entirely rousing I ought to concede. I like going by you site since I generally run over fascinating articles like this one.Great Job, I enormously acknowledge that.Do Keep sharing! Respects, check my ip address

markson said...

In the time of 2012 Gartner had anticipated that employment opportunities in Business Analytics and Data Scientist are surrendering to head toward somewhere in the range of Millions preceding 2015 attract to a nearbyData Analytics Course

vinith said...

Very Informative Article
Data Science Interview Questions

priyanka said...

I am looking for and I love to post a comment that "The content of your post is awesome" Great work!
data analytics course

dataexpert said...

This is exactly the information I'm looking for, I couldn't have asked for a simpler read with great tips like this... Thanks! ExcelR Data Analytics Courses In Pune

ek said...

Know more about Data Analytics
Cool stuff you have, and you keep overhaul every one of us.

priyash said...

wonderful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article resolved my all queries. keep it up.
data analytics course in Bangalore

priyash said...

wonderful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article resolved my all queries. keep it up.
data analytics course in Bangalore

priyash said...

wonderful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article resolved my all queries.
Data Science Course

priyash said...

Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
Correlation vs Covariance
Simple linear regression

priyanka said...

Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
Correlation vs Covariance
Simple linear regression
data science interview questions

datasciencecourse said...

After reading your article I was amazed. I know that you explain it very well. And I hope that other readers will also experience how I feel after reading your article.

Simple Linear Regression

Correlation vs Covariance

360digitmgas said...

Such a very useful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. best software training

Robert Beauty said...

I really appreciate the kind of topics you post here. Thanks for sharing us a great information that is actually helpful. Good day!192.168.1.254

priyanka said...

Amazing Article ! I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
Simple Linear Regression
Correlation vs covariance
data science interview questions
KNN Algorithm
Logistic Regression explained

priyanka said...

Amazing Article ! I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
Simple Linear Regression
Correlation vs covariance
data science interview questions
KNN Algorithm
Logistic Regression explained

priyanka said...

Amazing Article ! I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
Simple Linear Regression
Correlation vs covariance
data science interview questions
KNN Algorithm
Logistic Regression explained

priyanka said...

very well explained .I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
Simple Linear Regression
Correlation vs covariance
data science interview questions
KNN Algorithm
Logistic Regression explained

priyanka said...

very well explained .I would like to thank you for the efforts you had made for writing this awesome article. This article inspired me to read more. keep it up.
Simple Linear Regression
Correlation vs covariance
data science interview questions
KNN Algorithm
Logistic Regression explained

Unknown said...

Great Article Artificial Intelligence Projects

Project Center in Chennai

JavaScript Training in Chennai

JavaScript Training in Chennai

Mike Johnson said...

I like to post tiktok video about code and buy tiktok likes from this site https://soclikes.com/buy-tiktok-likes

Huongkv said...

Aivivu vé máy bay giá rẻ

vé máy bay tết

Vé máy bay đi Mỹ

vé máy bay Việt Nam đi Pháp

vé máy bay 1 chiều đi hàn quốc

giá vé máy bay đi osaka nhật bản

giá vé máy bay từ Hà Nội đi Anh

arshiya said...

Awesome article, I really enjoyed reading your blog. This is truly a great read for me.
what is keyword stuffing in seo
machine learning scope
angularjs plugins
rpa software
angularjs interview questions and answers
angularjs interview questions for freshers

Post a Comment

Ads