<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Instance &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/instance/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Sun, 25 Sep 2016 19:54:34 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.4</generator>
	<item>
		<title>SQL Server: Script to find PORT information of an Instance</title>
		<link>https://www.dbrnd.com/2016/10/sql-server-script-to-find-port-information-of-an-instance-of-network/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Tue, 25 Oct 2016 16:16:51 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server DBA Script]]></category>
		<category><![CDATA[1433]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Instance]]></category>
		<category><![CDATA[sql port]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3663</guid>

					<description><![CDATA[In this post, I am sharing one important T-SQL script to find out PORT information of the SQL Server Instance. When SQL Database Administrators are dealing with multiple SQL instances, this kind of script helps a lot to DBA. The Even Database Administrator can use this script for reporting purposes. Below T-SQL script to find [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fsql-server-script-to-find-port-information-of-an-instance-of-network%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20PORT%20information%20of%20an%20Instance" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fsql-server-script-to-find-port-information-of-an-instance-of-network%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20PORT%20information%20of%20an%20Instance" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fsql-server-script-to-find-port-information-of-an-instance-of-network%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20PORT%20information%20of%20an%20Instance" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fsql-server-script-to-find-port-information-of-an-instance-of-network%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20PORT%20information%20of%20an%20Instance" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fsql-server-script-to-find-port-information-of-an-instance-of-network%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20PORT%20information%20of%20an%20Instance" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fsql-server-script-to-find-port-information-of-an-instance-of-network%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20PORT%20information%20of%20an%20Instance" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fsql-server-script-to-find-port-information-of-an-instance-of-network%2F&#038;title=SQL%20Server%3A%20Script%20to%20find%20PORT%20information%20of%20an%20Instance" data-a2a-url="https://www.dbrnd.com/2016/10/sql-server-script-to-find-port-information-of-an-instance-of-network/" data-a2a-title="SQL Server: Script to find PORT information of an Instance"></a></p><p>In this post, I am sharing one important T-SQL script to find out PORT information of the SQL Server Instance. </p>
<blockquote><p>When SQL Database Administrators are dealing with multiple SQL instances, this kind of script helps a lot to DBA. </p></blockquote>
<blockquote><p>The Even Database Administrator can use this script for reporting purposes.</p></blockquote>
<p><strong>Below T-SQL script to find PORT information of the current instance:<br />
</strong></p>
<pre class="crayon-plain-tag">SET NOCOUNT ON
DECLARE 
	@Port VARCHAR(30)
	,@Key VARCHAR(150)
IF CHARINDEX('\',@@SERVERNAME,0) &lt;&gt;0
BEGIN 
	SET @Key = 'SOFTWARE\MICROSOFT\Microsoft SQL Server\'
				+@@SERVICENAME+'\MSSQLServer\Supersocketnetlib\TCP'
END
ELSE
BEGIN 
	SET @Key = 'SOFTWARE\MICROSOFT\MSSQLServer\MSSQLServer \Supersocketnetlib\TCP'
END 
EXEC master.sys.xp_regread 
	@Rootkey='HKEY_LOCAL_MACHINE'
	,@Key=@Key,@value_name='Tcpport'
	,@value=@Port OUTPUT

SELECT 'SQL Server Name: '+@@SERVERNAME + ' Port # '+CONVERT(VARCHAR(20),@Port)</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>SQL Server: Script to find Databases from all the Instances</title>
		<link>https://www.dbrnd.com/2016/10/sql-server-script-to-find-databases-from-all-the-instances/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Mon, 24 Oct 2016 16:16:45 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server DBA Script]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[Instance]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3667</guid>

					<description><![CDATA[In this post, I am sharing one T-SQL script to find all Databases from the all the SQL Server Instances. This script is very helpful for Database Administrators, who is managing different instances of SQL Server. Using this single T-SQL script, we can get the all Databases from all the running SQL Server Instances. Below [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fsql-server-script-to-find-databases-from-all-the-instances%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20Databases%20from%20all%20the%20Instances" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fsql-server-script-to-find-databases-from-all-the-instances%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20Databases%20from%20all%20the%20Instances" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fsql-server-script-to-find-databases-from-all-the-instances%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20Databases%20from%20all%20the%20Instances" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fsql-server-script-to-find-databases-from-all-the-instances%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20Databases%20from%20all%20the%20Instances" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fsql-server-script-to-find-databases-from-all-the-instances%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20Databases%20from%20all%20the%20Instances" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fsql-server-script-to-find-databases-from-all-the-instances%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20find%20Databases%20from%20all%20the%20Instances" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fsql-server-script-to-find-databases-from-all-the-instances%2F&#038;title=SQL%20Server%3A%20Script%20to%20find%20Databases%20from%20all%20the%20Instances" data-a2a-url="https://www.dbrnd.com/2016/10/sql-server-script-to-find-databases-from-all-the-instances/" data-a2a-title="SQL Server: Script to find Databases from all the Instances"></a></p><p>In this post, I am sharing one T-SQL script to find all Databases from the all the SQL Server Instances.</p>
<blockquote><p>This script is very helpful for Database Administrators, who is managing different instances of SQL Server.</p>
<p>Using this single T-SQL script, we can get the all Databases from all the running SQL Server Instances. </p></blockquote>
<p><strong>Below is a script:</strong></p>
<pre class="crayon-plain-tag">DECLARE @InstanceName NVARCHAR(128)

CREATE TABLE #Databases 
(
	[ServerName] VARCHAR(128)
	,[DatabaseName] VARCHAR(128)
)

DECLARE SQLCur CURSOR
FOR
SELECT NAME
FROM sys.servers

OPEN SQLCur
FETCH NEXT
FROM SQLCur
INTO @InstanceName
WHILE @@FETCH_STATUS = 0
BEGIN
	DECLARE @SQL VARCHAR(MAX) = NULL
	SET @SQL = 
	'
		INSERT INTO #Databases
		([ServerName],[DatabaseName])      
		SELECT ''' + @InstanceName + '''
		,name FROM  [' + @InstanceName + '].master.Sys.Databases 
		WHERE database_id &gt; 4
	'
	EXEC (@SQL)
	FETCH NEXT
	FROM SQLCur
	INTO @InstanceName
END
CLOSE SQLCur

DEALLOCATE SQLCur
SELECT 
	ServerName
    ,DatabaseName
    ,(
        SELECT count(*) AS DBCount
        FROM #Databases AS I
        WHERE I.ServerName = O.ServerName
     ) AS InstanceDBCont
FROM #Databases O
GO

DROP TABLE #Databases
GO</pre> </p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
