T-SQL

How to delete a SQL Server function with a script ?

How to delete a SQL Server function with a script? How to delete a user-defined SQL Server function with a T-SQL script, and avoid errors? This SQL commands allows to get rid of a SQL Server function. It also check if the function exists. This tutorial shows how to do this with simple examples. And the last example provides a script to drop all the

T-SQL

SQL Server data types with code examples to create columns

List of SQL Server data types for creating columns or variables in T-SQL. Here is the complete list of SQL Server data types, with examples written in T-SQL (Transact-SQL) to declare and instantiate each data type. In fact, in Transact-SQL, there are several data types that can be used to store different types of values in a database. The different categories of SQL Server

T-SQL

SQL Server string longer than 8000 characters

How to manage SQL Server strings with more than 8000 characters without errors? Using SQL Server string longer than 8000 characters with VARCHAR and NVARCHAR fields and explicit lenght is not possible. Indeed the explicit declarations are limited to 8000 characters with SQL Server. Handle text fields longer than 8000 characters and you get the following message, The text, ntext, and image data types

T-SQL

Split string with delimiter into one column with SQL Server

How to split a string with delimiter with XML or STRING_SPLIT functions with SQL Server ? Split a string with delimiter, like comma or semicolon, into one column using SQL Server. With a T-SQL query, it is possible to cut a string compounded of text, delimited by commas, semicolons, tabulations, dash, underscore, or even dots. It can basically be any special character that defines

T-SQL

Return values with SQL Server stored procedure

How to create a SQL Server stored procedure to return values with OUTPUT? This simple T-SQL example returns values through output parameters. Setting up, instantiating, and using the output parameters of a stored procedure is similar to that of the input parameters. The major difference is the OUTPUT clause after the parameter name. The OUTPUT keyword specifies that the stored procedure must return a

T-SQL

Drop SQL Server stored procedures without errors

How to drop a SQL Server stored procedure without error using the existence check? To drop a SQL Server stored procedure and avoid errors, first test the existence of the procedure in the SQL Server database to condition the DROP PROCEDURE command. On the other hand, it is a good practice to always test the existence of SQL Server objects. In this case a

T-SQL

Store a SQL Server column in a variable with delimiters

Query to store the contents of a SQL Server column in a variable, inline and with delimiters. SQL tutorial to read and store the result from a SQL Server column in a variable, and with separators. In some cases, it is useful to get all the values of a column in a T-SQL variable and add a delimiter. How to store the contents of

T-SQL

Format a SQL query automatically and for free

How to format a SQL query automatically with a free online service? Format a SQL query automatically can be time-consuming and tedious, especially on existing projects that are not developed according to the rules of the art. There is a useful website that allows you to format SQL queries. Indeed, it is aimed at SQL development engineers, DBAs, and in general all SQL developers.

T-SQL

SQL Server SELECT query examples to display and filter data from tables

Example queries with the SQL Server SELECT function to select, filter and display data. This tutorial offers an extensive collection of SQL Server SELECT query examples to display and filter data from tables. The SELECT query is a powerful and versatile command that allows you to extract and manipulate data with precision and ease. By mastering its usage, you can enhance your Structured Query

T-SQL

Test and drop a SQL Server view if it exists in the database

How to test and then drop a SQL Server view, if it exists in the database? Here is how to test the existence and drop a SQL Server view with a T-SQL script. Use this script as an example to test the existence of the view before deleting it. The goal is to not generate an error during the execution of a deployment script