I want to display the employees who have joined in last two
months. (It should be executed randomly means If I execute
the query in March it should display Jan and Feb joined
employees. Same query if i execute in Feb, 2007 it should
display dec, 2006 and jan 2007 joined employees.

Answer Posted / balaji s.t

select convert(varchar(10),
dateadd(dd,-(day(dateadd(mm,1,getdate()))-1), dateadd(mm,-2,getdate())), 120),

convert(varchar(10),dateadd(dd,-(day(getdate())),getdate()),120)

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

is it possible to pass an object or table to a procedure as an argument?

689


What is foreign key in sql with example?

589


What is sql keyword?

657


Is sql a case sensitive language?

623


what are all the common sql function? : Sql dba

677






What is procedure in pl sql?

614


What are functions in sql?

580


What is the use of index in sql?

660


Can there be more than one function with a similar name in a pl/sql block?

634


Is ms sql traffic encrypted?

595


What is the difference between stored procedure and view?

642


How to return multiple rows from the stored procedure?

621


What is package in pl sql with an examples?

628


What will you get by the cursor attribute sql%rowcount?

645


Describe types of sql statements?

635