SQL Server Stored Procedures

How to alter a SQL Server stored procedure?

How to alter an existing stored procedure in a SQL Server database? Simply use the alter command instead of the create command one to modify an existing SQL procedure. In this example let’s add the grouping on months and employees to sum up and group data. Let’s add also a

SQL Server Stored Procedures

How to create a SQL Server stored procedure?

How to create a simple SQL Server stored procedure? This example in transact SQL code list all the Customers from the Customers table by using the selection function. This example do not use any where clause to filter the results. Its a simple example to remind the syntax creation for

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 object managed 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? How to drop a view? 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 simple T-SQL

SQL Server Strings

How to remove SQL Server line break from a text?

How to remove SQL Server line break from a text? If you store a string as a variable or a column in SQL Server, then it can contain line breaks. For example, if you export the string to excel, your line will be cut. Indeed, with SSMS, if you select

SQL Server

List tables and disk space in SQL Server

List tables and disk space in 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

Blue and grey gearwheels image
SQL Server

SQL Server unpivot

How to use a SQL Server unpivot 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

SQL Server

Check the last update date on a SQL Server table

How to check the last update date on a SQL Server table? Check the last access and update with a simple SQL query? Thanks to the SQL Server relational database management system tables, a query allows you to display the last changes done. We can apply it to any SQL

SQL Server

How to 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