开发者

Selecting records with specific month and year in SQL Server 2005

开发者 https://www.devze.com 2023-02-18 22:20 出处:网络
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# applicatio

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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号