How to truncate string using SQL server

If you only want to return a few characters of your long string, you can use: See SQL Fiddle with Demo. This will return the first 15 characters of the string and then concatenates the … to the end of it. If you want to to make sure than strings less than 15 do not … Read more

In SQL Server, what does “SET ANSI_NULLS ON” mean?

It means that no rows will be returned if @region is NULL, when used in your first example, even if there are rows in the table where Region is NULL. When ANSI_NULLS is on (which you should always set on anyway, since the option to not have it on is going to be removed in the future), any comparison operation where (at least) … Read more