Monthly Archives: August 2014

LTRIM() function in SQL Server

LTRIM ():- This function is used to get the string after the removal of leading blank spaces. Syntax:- LTRIM ( character_expression ) For example:- Select LTRIM  (‘  Vivek Johari’) Result:- Vivek Johari (without blank spaces on left side)

Posted in SQL Functions, SQL Server | Tagged | 21 Comments

Substring() function in SQL Server

Substring():- This function is used to return the specified number (third argument “len”) of characters from a given string(first argument) from the start position as specified as the second argument. Syntax:-    Select  SUBSTRING ( expression ,start , length ) … Continue reading

Posted in SQL Functions, SQL Server | Tagged | 31 Comments

Max() function in SQL Server

Max():- This function gives the maximum value of the selected column Syntax:- Select Max (col1) from table_name In this article, we are going to use the following table for the examples:- CREATE TABLE [dbo]. [Employee]( [Empid] [Int] IDENTITY (1, 1) … Continue reading

Posted in SQL Functions, SQL Server | Tagged | 26 Comments

AND and OR Operator in Sql Server

And & Or:- These Operators are used to further filter the recordset return by SQL queries when more than one conditions are specified. In case of “AND” all the conditions must be true and in case of “OR” any of … Continue reading

Posted in SQL Basic Concepts, SQL Server | Tagged | 31 Comments

RTRIM() function in SQL Server

RTRIM():-This function is used to get the string after the removal of all trailing blanks. Syntax:- RTRIM ( character_expression ) For example:- Select RTRIM(‘Vivek Johari  ‘) Result:- Vivek Johari (without blank spaces on Right side)

Posted in SQL Functions, SQL Server | Tagged | Leave a comment

SUM() function in SQL Server

Sum():- This function is used to get the sum of values of the specified numeric column.  Syntax:-  Select Sum (column_name) from tablename Example:- In this article, we are going to use the following table for the examples:- CREATE TABLE [dbo]. … Continue reading

Posted in SQL Functions, SQL Server | Tagged | 31 Comments

Round() function in SQL Server

Round():-This function is used to round a numeric field to the number of decimals specified. Syntax:-     ROUND ( numeric_expression , length [ ,function ] numeric_expression :-Expression of the exact numeric or approximate numeric data type category, except for the … Continue reading

Posted in SQL Functions, SQL Server | Tagged | 31 Comments

Except command in SQL Server

Except command in SQL Server returns the distinct values from the left query that are not also found on the right query. For Except command, below basic rules must be followed. The number and the order of the columns must … Continue reading

Posted in SQL Basic Concepts, SQL Server | Tagged | 19 Comments

Like() function in SQL Server

Like:- This operator is used in a WHERE clause to search for a specific pattern in the values of the column. In this article, we are going to use the following table for the examples:- CREATE TABLE [dbo]. [Employee]([Empid] [Int] … Continue reading

Posted in SQL Functions, SQL Server | Tagged | 31 Comments

Best practices for Database Programming

1. All the tables in the database have properly defined relationship using primary keys and foreign keys .2. Indexes should be created on the tables as it increases the performance of the SQL Queries. 3. Find the indexes which need … Continue reading

Posted in SQL Best Practices, SQL Server | Tagged | 31 Comments