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...


create table with fields ID, reserved_by,res_date
res_date is datefield like 2010-03-09 00:00:00.000 from
2005 to 2006 any date assume
based on res_date need to slect table and display
based on month (full jan details in database irrespective
of date and year

Answers were Sorted based on User's Feedback



create table with fields ID, reserved_by,res_date res_date is datefield like 2010-03-09 00:00:00.0..

Answer / sandip

//Show records for a given month
SELECT * FROM table_name (NOLOCK)
WHERE SUBSTRING(res_date, 6, 2) = (numeric value for month.
eg 01 for Jan)


//Show all the records sorted by res_date based on month.
SELECT * FROM table_name (NOLOCK)
ORDER BY SUBSTRING(res_date, 6, 2) ASC

Is This Answer Correct ?    3 Yes 0 No

create table with fields ID, reserved_by,res_date res_date is datefield like 2010-03-09 00:00:00.0..

Answer / thangas sujith prabu.s

select * from tablename where res_date>'2010-01-01
00:00:00.000' and res_date<'2010-02-01 00:00:00.000'

Is This Answer Correct ?    2 Yes 1 No

create table with fields ID, reserved_by,res_date res_date is datefield like 2010-03-09 00:00:00.0..

Answer / anilkumar manthena

select * from <Table> where datepart(month,res_date)=1
It will return all the reservations made on Month "January".

Ex:
SELECT DATEPART(month, '2009-02-13 18:35:06.523')
retrieves the value 2.

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More SQL Server Interview Questions

Explain the steps to use transact-sql cursor?

0 Answers  


What is difference between index seek vs. Index scan?

0 Answers  


How to include text values in sql statements?

0 Answers  


9. Write a query to list a new column with the difference in temp of the cities Delhi and Mumbai, Mumbai and Jammu and soon. Consider the following table : City_id City Temp. 1 delhi 40 2 Mumbai 35 3 Jammu 32 4 Pune 18

2 Answers  


What types of replication are supported in sql server?

0 Answers  


What do mean by xml datatype?

0 Answers  


Explain the categories of stored procedure?

0 Answers  


How to Display, Amount of Disk Activity Generated by Transact-SQL Statements?

1 Answers  


what is the difference between table and view

1 Answers  


What is model database? : SQL Server Architecture

0 Answers  


Which language is supported by sql server?

0 Answers  


Define msdb database?

0 Answers  


Categories