Selecting records with specific month and year in SQL Server 2005
I want to list records with a particular month and year. The table name is 'Arrival' and 'date' is the field that stores the date that the record was added. This is to be done from a C# application. For example, if the user selects month as 'April' and year as '2009' in the application, it will list all the records that were added on April,2009. (I only need the query, hope I can figure out the rest :开发者_运维知识库) )
Probably easiest to create a stored procedure that takes Month and Year inputs as int. The body would be something like this:
Select /*Column List */
from Arrival
where Month([Date]) = @Month
and Year([Date]) = @Year
精彩评论