Publications

SQL Server Listening Port

Davide Mauri

Script per identificare le porte TCP sulla quale è in ascolto SQL Server

------------------------------------------------------------------------
-- Version: 1
-- Release Date: 2012-08-01
-- Author: Davide Mauri (SolidQ)
-- License: Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Italy License.
------------------------------------------------------------------------
use tempdb
go

declare @is_named_instance bit;
declare @key nvarchar(1024)
declare @tcp_port nvarchar(1024);
declare @tcp_enabled bit;

declare @Protocols table (Value1 nvarchar(1024) null, Value2 nvarchar(1024) null, Data nvarchar(1024) null);

set @is_named_instance = case when @@servicename <> 'MSSQLSERVER' then 1 else 0 end;

if (@is_named_instance = 1)
begin
    set @key = 'SOFTWARE\MICROSOFT\Microsoft SQL Server\'+@@servicename+'\MSSQLServer\Supersocketnetlib'
end
else
begin
    set @key = 'SOFTWARE\MICROSOFT\MSSQLServer\MSSQLServer\Supersocketnetlib'
end
;

insert into @Protocols exec master..xp_regread @rootkey='HKEY_LOCAL_MACHINE', @key=@key, @value_name='ProtocolList';

if exists(select * from @Protocols where Value2 = 'tcp') set @tcp_enabled = 1 else set @tcp_enabled = 0;

set @key = @key + '\TCP';
exec master..xp_regread @rootkey='HKEY_LOCAL_MACHINE', @key=@key, @value_name='TcpPort', @value=@tcp_port OUTPUT

select
    server_name = @@SERVERNAME,
    instance_name = @@SERVICENAME,
    tcp_enabled = @tcp_enabled,
    tcp_port = @tcp_port
;

Attenzione, lo script suddetto fa uso della stored procedure non documentata xp_regread! Con SQL Server 2012, invece, è sufficiente usare la DMV

SSDT Power Tools

Davide Mauri

Oltre al rilascio della nuova versione di SQL Server Data Tools, è stato anche rilasciato l’aggiornamento (versione 1.3) dei relativi “Power Tools” che ne estendono ulteriormente le funzionalità:

http://visualstudiogallery.msdn.microsoft.com/9b0228c6-15d1-44de-9279-66dde12bf861?SRC=Featured

La novità introdotta è legata all’utilizzo delle Data Tier Application, come riporta il seguente estratto:

“In this version, we added commands in SQL Server Object Explorer to create and deploy *.dacpacs (Data-tier Applications), the core artifact of the DAC Framework. You can find these commands by right-clicking on the Databases node or individual database nodes in SSOX. These commands also provide the ability to include data for a select set of tables in .dacpacs.”

SQL Server Data Tools: aggiornamento di Settembre

Davide Mauri

E’ stato aggiornato il SQL Server Data Tools (ex Business Intelligence Development Studio) in modo da poter essere usato anche con Visual Studio 2012, almeno per quanto riguarda lo sviluppo dei Database.

Le novità sono ovviamente disponibili anche con la versione classica, basata su Visual Studio 2010.

Informazioni dettagliate sulle novità, direttamente dal team di sviluppo, nel post dedicato.

Per chi non conoscesse SQL Server Data Tools, ricordo che permette lo sviluppo di codice T-SQL direttamente da Visual Studio con tutta una serie di feature avanzate che ne rendono molto comodo l’utilizzo.