Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Find rows with inv_dates
Message
 
To
01/05/2017 10:43:39
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
01650725
Message ID:
01650726
Views:
81
This message has been marked as the solution to the initial question of the thread.
>I have another brain freeze
>I know the beginning year and month and the ending year and month (all integers)
>I want to write a query that returns all rows with inv_dates between those months and years.
>All graciously accepted.
WHERE inv_dates 
  BETWEEN CONVERT(DATETIME,CAST(@fromyear AS VARCHAR(4))+'-'+CAST(@frommonth AS VARCHAR(2))+'-01',120) AND 
                  DATEADD(m,1,CONVERT(DATETIME,CAST(@toyear AS VARCHAR(4))+'-'+CAST(@tomonth AS VARCHAR(2))+'-01',120))-1
MartinaJ
"Navision is evil that needs to be erazed... to the ground"

Jabber: gorila@dione.zcu.cz
Jabber? Jabbim
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform