SQL Server Strings

How to remove SQL Server line break from text?

How to remove SQL Server line break from 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

SSMS option to check object existence in SQL scripts

How to add or remove the object existence checks in SQL creation scripts with SQL Server Management Studio? To add dynamically the existence check before generating the create statement for you SQL Objects like tables, views,  functions or stored procedures, it’s easy. Simply activate this SSMS option to check object existence in

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

SQL Server Errors

Arithmetic overflow error converting expression to data type int

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

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

SQL Server Errors

SQL Server error conversion from XML to NVARCHAR

How to convert XML into NVARCHAR with SQL Server? To avoid the SQL Server error conversion from XML to NVARCHAR. The exact message is “Implicit conversion from data type xml to nvarchar is not allowed. Use the CONVERT function to run this query.”. With SQL Server data, it is useful