Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

we have emp table like Ename,EDOJ,EDOB with Column
structure.but we want to know the employee Age.How? Any
Body Plz

Answer Posted / rajesh k. gupta

Hi,
In order to answer your question I would like to put all
three possible answers as follows:-

1.If You want to find out the age of employee as on the
date of Joining (Field name EDOJ) then Query will be

select *,datediff(year,EDOB,EDOJ) as Eage from emp

2. If you want to find out the age of employees as on
current date, query will be as follows:-

select *,datediff(year,EDOB,getdate()) from emp

3. If you want to find out age as on specific date stored
and taken from other variable then query will be :-

You need to declare a variable as datetime then need to
tore its value to it.

declare @dtb datetime
set @dtb='1990/01/10'
select *,datediff(year,EDOB,@dtb) from emp
---------------------------------------
For any clarification Please feel free to contact me.
Rajesh
9342284359

Is This Answer Correct ?    7 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to convert character strings into numeric values?

1032


What is shrink log file?

839


What are .mdf files?

885


What is the sql server 2000 version number?

1007


How network traffic be reduced by using the stored procedure?

1044


What are the purpose of Normalisation?

998


What is the full form of dql?

927


What is the stuff?

947


What is a cube? : sql server analysis services, ssas

944


How to receive returning result from a query?

1033


List the various tools available for performance tuning?

842


What is sql server 2000 work load governor?

975


Explain the advantages of merge replication?

893


Explain syntax for viewing, dropping and disabling triggers?

896


What is the template in sql?

914