Category Archives: TSQL

Get Client IP Address in SQL Server

CREATE FUNCTION [dbo].[GetCurrentIP] () RETURNS varchar(255) AS BEGIN DECLARE @IP_Address varchar(255); SELECT @IP_Address = client_net_address FROM sys.dm_exec_connections WHERE Session_id = @@SPID; Return @IP_Address; END

Posted in TSQL | Leave a comment

SQL Server Sample Databases

SQL Server Sample Databases

Posted in TSQL | Leave a comment

SQL Data Types

Exact Numeric bigint “-2^63” to “2^63” 8 Byte int “-2^31” to “2^31” 4 Byte smallint “-2^15” to “2^15” 2 Byte tinyint “0” to “255” 1 Byte bit “0” to “1” 1 Bit decimal                               “-2^31”            to                “2^31”           4Byte numeric                              … Continue reading

Posted in TSQL | Leave a comment