SQL Server Functions

How to call a SQL Server function?

How to call a SQL Server user defined function? The SQL syntax to call a function is different from the call to a stored procedure. Use SQL Server function the same way you select data from a table. How to call a SQL Server function? A SQL Server user-defined function

SQL Server Tables

How to delete a SQL Server table?

How to delete a SQL Server table? How to drop a table without checking if the table exists? Assume the object is already in the database. How to delete a SQL Server table from the database with a query? Here is a SQL script to create a SQL Server table.

SQL Server Functions

How to manage SQL Server functions?

How to manage SQL Server functions? SQL Server user-defined functions are very useful when you start T-SQL development on SQL Server. You need to use them very often so you have to learn the right syntaxes and avoid errors. At the beginning it can be tricky and frustrating because it’s binary, it

SQL Server Tables

How to create a SQL Server table?

How to create a SQL Server Create table with a simple query? This basic SQL example creates a table to store Sales data. It is using different data types, such as strings, numeric values, decimal values, integers and boolean. This SQL Server example is easy to customize. Just copy and paste

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

SQL Server Errors

SQL Server Implicit conversion from data type XML to nvarchar

How to convert XML into NVARCHAR with SQL Server? To avoid this error “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 to combine numerical columns, alphanumeric strings and XML typed columns.  In

SQL Server

How to list all SQL Server indexes?

How to list all SQL Server indexes? It can be very useful to display all database indexes to have an idea at a glance at how this SQL Server database is optimized with indexes, whether CLUSTERED or NON CLUSTERED. This query offers you a synthetic list of indexes. If shows

SQL Server

Display SQL Server version with sql 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’s possible by using simple T-SQL queries.   For example, it’s very helpful to know the exact version of SQL