0

designing an inventory system and i want to generate crystal reports from sql queries. Actually want to generate monthly and yearly reports from the daily sales reports i have populated. someone please help me.

3
Contributors
4
Replies
7
Views
7 Years
Discussion Span
Last Post by debasisdas
0

Hi

SQL Server supports DatePart so if you are actually storing your dates as date type values then:

SELECT DatePart(month, Mytable.MyDateValue) As TheMonth FROM MyTable

Also I've fairly sure I've seen MONTH() used as well:

SELECT MONTH(MyDate) As TheMonth From MyTable

Both of these will give you an integer e.g. 1 for January etc...
You could then use MonthName in your VB.net to get the actual name...

Note of caution, if you are inputing the date values you should always input them in dd mmmm yyyy or yyyy-mm-dd format this ensures the dates are being stored in the correct format in your DB. i.e. 08/09/2011 to me is the 8th Septemeber (European format) but could be August 9th to someone from the US or server using US formats.

0

thank you very much....but i also want to generate monthly and yearly reports based on daily transaction. How do i go about it.
I have Salestbl with fields recID, ItemName, Qty, UnitPrice, TotalPrice and DateOfEntry.
i want to create monthly bar charts when user enter year

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.