Change an Existing Column to a Computed Column in SQL Server (T-SQL Example)

This article demonstrates how to use T-SQL to change an existing column to a computed column in SQL Server.

A computed column is a virtual column that uses an expression to calculate its value. The expression will typically use data from other columns. A computed column is not physically stored in the table unless it’s marked PERSISTED.

Continue reading

Add a Computed Column to an Existing Table in SQL Server

This article demonstrates how to use T-SQL to add a computed column to an existing table in SQL Server.

A computed column is a virtual column that uses an expression to calculate its value. The expression will typically use data from other columns. A computed column is not physically stored in the table unless it’s marked PERSISTED.

Continue reading

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

Including Tables & Schemas when Listing the Identity Columns in a SQL Server Database

If you’ve ever queried the sys.identity_columns view in SQL Server, you’ll know that it returns a list of identity columns. It also returns the object_id of the table, but not the table name or its schema.

You can use the code examples in this article to return the identity columns, along with their respective tables and schemas.

Continue reading