SQL Server

SQL Server Alter Function

How to update the code of an SQL Server function without deleting it? The solution is to update its definition using the SQL Server Alter Function command. The query updates the function already created in the database. This new code returns not only the customer name, but also the customer

SQL Server

SQL Server Create Function

How to write an SQL Server Create Function query? This SQL Server function takes as a parameter the customer number and returns the customer name. Indeed, the function stores the customer name in the @CustomerName variable, and it returns it as a result.   SQL Server Create Function The different steps

SQL Server Tables

Drop a SQL Server table if exists

How to drop a SQL Server table if exists? How to drop it only if the existence check shows it already exists in the database to avoid errors, using the DROP TABLE keyword. Indeed when running long SQL scripts or running scripts twice, it is much better to test the

SQL Server

Remove SQL Server new line

How to remove SQL Server new line? This post propose a simple SQL Server query to process a string variable and remove the new line character. Technically we replace the new line by nothing. The SQL Server code for a new line is CHAR(13)+CHAR(10).     You want to remove it to

SQL Server Functions

SQL Server functions – How to create, modify and call

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 work or don’t work, programming T-SQL

SQL Server Tables

SQL Server Alter Table

How to modify an object with an SQL Server Alter Table query? This ALTER TABLE SQL Server query helps you modify an already existing table. This SQL script allows you to modify the Sales table previously created, by changing the length of the Month Name column. Of course you need