Tags » SQL Query

SQL: Aggregates, Group By, and Having

The Where clause is great. It helps you filter out items from a table, leaving only the records you want. But sometimes you are not looking for the actual records. 196 more words


Calculate Age in Years through Sql

How to Calculate Age though Sql?

MyTableName:- field is Id, Name, DateOfBirth.

Select CONVERT(int,ROUND(DATEDIFF(hour,DateOfBirth,GETDATE())/8766.0,0)) AS AgeYearsIntRound from dbo._ABEntity1

Select CONVERT(int,ROUND(DATEDIFF(day,DateOfBirth,GETDATE())/369,0)) AS AgeYearsIntRound from dbo._ABEntity1… 23 more words

Interview Question

SQL: SELECT Functions (Top, Count, Distinct, Max, Min)

I introduced you to the SELECT statement in SQL in my last SQL posting: SQL: SELECT Statement

Now I am going to show you some tricks that will provide you with more functionality in your Select statements. 492 more words


SQL: SELECT Statement

SELECT is doubtlessly the most important command in SQL. A database is completely useless unless you can query the data it is holding. SELECT is how we query. 588 more words


Execute As in SQL (Similar to Runas in Windows context)

When we need to execute any SQL statement with other user context we have to use EXECUTE AS statement to impersonate other user access.

Impersonation can be done as different login or different user.This is similar to RunAs in windows context… 99 more words


BI SQL # 278 : SQL Server DBA Scripts : How to Quick Search Anything in Database in SQL Server

Hi Friends,

In this article we are going to cover How to Quick Search Anything in Database.

In this post we are going to discuss following points:

191 more words
Vishal Pawar

Improving SQL Query Performance

As SQL query performance improvement is a very debating topic between developers and the other user community. Users always wants a fast response on their data retrieval action and developers put forth their best efforts to provide the data in the minimum time span, however, there is no straightforward way to define what is the best performance. 1,091 more words

Database Administrator