How @@MAX_CONNECTIONS Works in SQL Server

In SQL Server, the @@MAX_CONNECTIONS configuration function returns the maximum number of simultaneous user connections allowed on an instance of SQL Server. The number returned is not necessarily the number currently configured.

No argument is required. You can simply use it in a SELECT statement to return the maximum number of simultaneous user connections allowed on the current server.

Continue reading

Use CRYPT_GEN_RANDOM() to Create a Cryptographic, Random Number in SQL Server

In SQL Server, you can use the CRYPT_GEN_RANDOM() function to return a cryptographic, randomly-generated number. The number is generated by the Cryptographic Application Programming Interface (CAPI).

CAPI is a Microsoft Windows platform specific application programming interface included with Microsoft Windows operating systems that provides services to enable developers to secure Windows-based applications using cryptography.

The CRYPT_GEN_RANDOM() function accepts two arguments: the length (required), and a seed (optional).

The return value is varbinary(8000).

Continue reading

What is @@TEXTSIZE in SQL Server?

In SQL Server, the @@TEXTSIZE configuration function returns the current value of the TEXTSIZE option.

No argument is required. You can simply use it in a SELECT statement to return the current TEXTSIZE value.

The TEXTSIZE value specifies the size of varchar(max), nvarchar(max), varbinary(max), text, ntext, and image data returned by a SELECT statement. This value can be set using SET TEXTSIZE.

Continue reading