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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are 3 ways to get a count of the number of records in a table?

1055


What is difference between views and stored procedures?

960


Why is normalisation important?

927


What are the types of table?

957


How to execute stored procedure and set temp table in sql server?

1021


Explain different types of collation sensitivity?

961


How to create indexed view?

1026


What is rolap and its advantage? : sql server analysis services, ssas

1259


What is nonclustered index with included columns ?

945


Define ACID properties in a Database?

1043


What protocol does sql server use?

929


What command is used to create a database in the sql server and how?

1159


How to remove duplicate rows from table?

1217


What is normalization of database? What are its benefits?

1010


What action plan is preferred if sql server is not responding?

1087