Tuesday, October 6, 2015

SQL : Sql Query Execution Order

Most programming languages executes set of statements from Top to Bottom but SQL Server executes set of statements in a logical order which is uniquely decides by the SQL Server in a predefined order known as Logical Query processing phase.

Introduction

When we are developing an application our concern mostly related to the code optimization which enhances the performance of application. When we are talking about an application it has broadly divided into two part one is the our code written in any programming language and other is the code written in database which executes at database level and return the results to our application.
In real world most application facing the performance issue which can be improved by code optimization. Here we will talk about the SQL query optimization.Most programming languages executes set of statements from Top to Bottom but SQL Server executes set of statements in a logical order which is uniquely decides by the SQL Server in a predefined order known as Logical Query processing phase.

Thursday, February 7, 2013

Simple script to backup all SQL Server databases

Working as developer or DBA, we often required to take the backup of database. This is not a big deal if you have a handful of databases, but this task become very hectic if the there is number of databases (ex. 50+) on the same instance of SQL Server. You could use SQL Server Management Studio to backup the databases or even use Maintenance Plans, but using T-SQL is a much simpler and faster approach.

Tuesday, December 25, 2012

Return SQL Query Result as XML in SQL Server- AUTO Mode

In previous post Return SQL Query Result as XML in SQL Server , I explained For XML clause for getting the query result as XML. I also explained RAW mode of this clause. Today I will explain AUTO  mode in FOR XML  clause.

Monday, December 24, 2012

Return SQL Query Result as XML in SQL Server

SQL Server gives you option to retrieve data as XML by supporting For XML clause, which you can use as a part of your query. For XML clause supports different options that let you define the format of XML data.

For XML clause supports four modes- RAW, AUTO, EXPLICIT, PATH. When you include the FOR XML clause in your query, you must specify one of these four modes.

Thursday, December 6, 2012

Select random records from database (MySQL, Oracle, MS SQL)

Sometimes we need to select random records from a table in our database. For example, if you created online test application then every time we need to get the random questions from our questions table.
Today I will give you some examples for selecting random records in some popular databases.

^ Scroll to Top