SQL Server Views

How to create a SQL Server view?

How to create a SQL Server view to display specific columns from an existing table? Consider a view as a virtual table defined by a SQL query. It’s a set of columns and rows from a table. A user defined view is a view created by a SQL Server developer.

SQL Server Views

How to delete a SQL Server view?

How to delete a SQL Server view from the database? For a SQL developer it’s a good practice to have a clean database and remove the unused or useless code. Unlike the tables, the views can be deleted from the database using a SQL command. How to delete a SQL

SQL Server

SQL Server list all the tables and disk space

List all existing tables from an SQL Server database can be very convenient especially to analyze the disk usage and the free disk space used by each table. Three different ways, but similar are presented here to display SQL Server tables and disk space used by each table. The third solution

Blue and grey gearwheels image
SQL Server

SQL Server UNPIVOT function example

How to use a T-SQL query to transform columns to rows? It’s possible with this simple SQL Server UNPIVOT function example. The T-SQL Unpivot function can do it in one single query. In this example, only the six first months of the year are used as columns, namely January to

SQL Server

Check SQL Server table last update and access

How to check SQL Server table last update and access? Check the last access and update with a simple SQL query? Thanks to SQL Server RDBMS system tables, a query allows you to display the last changes done. We can apply it to any SQL Server table or view, like

SQL Server

List User Defined Table Types with SQL Server

How to list User Defined Tables Types of your SQL Server database? First of all, users declare User Defined Table Type as a particular table structure in the database. A database user declares it and not the system. It’s good to ensure users can’t insert data with different types or

SQL Server Errors

Arithmetic overflow error converting expression to data type int

With SQL Server, let’s insert some data into a table using a stored procedure for example. Facing this SQL Server error message can be disturbing “Arithmetic overflow error converting expression to data type int”. Even if SQL conversion errors are very classical ones, finding the solution and best practices to

SQL Server

SQL Server Pivot query rows to columns

How to use the SQL Server Pivot query to change rows to columns with the SQL built-in function ? The SQL Server Pivot query can pivot lines to columns. What is the easy syntax of a PIVOT query? The PIVOT function is pivoting the lines into columns, in order to