SQL Server

Display SQL Server version with a query

How to display the SQL Server version exact number with a simple SQL Server query? Using SQL Server Management Studio, to get the exact version of the SQL Server installation, it is possible by using simple T-SQL queries. For example, it is very helpful to know the exact version of

SQL Server Errors

SQL Server Violation of unique key constraint

How to insert or update data in an SQL Server table with a simple query? Here are two simple solutions to execute an update or insert and avoid errors. The SQL Server error ” Violation of UNIQUE KEY constraint . Cannot insert duplicate key in object . The duplicate key

blank
SQL Server Time and Dates

Time difference in hours minutes and seconds

How to calculate time difference in hours minutes or seconds in SQL Server? The SQL Server function DATEDIFF() allows us to calculate the difference between two timestamps, but only in one unit. For example, only seconds, or only minutes or only hours. So, calculating the difference between a start date

blank
SQL Server Errors

Invalid object name SQL Server CTE Error

How to execute multiple SELECT queries on the same CTE? As a reminder, a CTE is a temporary object that only exists between its creation and the first time it’s used. It means it’s deleted right after the first query ran against the CTE. Indeed when querying the second time