If you work with stored procedures or if you script objects in SQL Server, you have probably seen SET statements that turn on/off some crazy thing called ANSI_PADDING. If you’re like most people, you just ignore this because it works. I wanted to take a few minutes to explain what this ANSI_PADDING thing is.

ANSI_PADDING is an option that controls how VARCHAR and VARBINARY values are stored. If ANSI_PADDING is turned on, then SQL Server will NOT trim the trailing spaces when it inserts into a VARCHAR field. Similarly, it will NOT trim trailing nulls when it inserts into a VARBINARY field.

Setting the ANSI_PADDING only affects the spaces on inserts. It does NOT affect comparisons.

Syntax For Setting The ANSI_PADDING:

SQL Rank Vs Row Number


SQL Rank Vs Row Number is a common question because the two functions are very similar. SQL Server has the two similar built-in functions to assign numbers to the order of the data in the result set. The SQL Server RANK function and the ROW_NUMBER function both can accomplish this, but they do something slightly different. You can follow these links see details on how to use this functions at RANK function and ROW_NUMBER function.

ROW_NUMBER: Returns a sequential number starting at 1 in the order specified. If there are duplicate records, SQL Server will continue the sequence on the duplicated record… ensuring that the row number sequence is never duplicated.

RANK: Returns a sequential number starting at 1 in the order specified. If there are duplicate records, SQL Server will use the same number for the duplicate records. There will then be a gap in the sequence for the duplicated records.

    RANK: http://msdn.microsoft.com/en-us/library/ms176102.aspx
    ROW_NUMBER: http://msdn.microsoft.com/en-us/library/ms186734.aspx

What Is SQL Server


What Is SQL Server
SQL Server is a database management system (DBMS) produced by Microsoft. The purpose of SQL Server is to store and retrieve data for use in computer applications. These applications could be mobile apps, web sites, desktop applications, or more.

Data in SQL Server is stored in tables. These tables have rows and columns, much like you would see in an Excel spreadsheet. SQL Server accesses this data using a coding language called T-SQL (Transact-SQL). This code is called a query. Here is a sample query that pulls all of the data from a table.

Easiest Definition Of “What Is SQL Server”
SQL Server is a program built by Microsoft that other programs can use to store and retrieve data.