Traditional Culture Encyclopedia - Almanac inquiry - Sqlserver queries all the data that are not in this time period this month (for example, the whole April is not in the time period of 7.30-8.3012.30-13.30)?
Sqlserver queries all the data that are not in this time period this month (for example, the whole April is not in the time period of 7.30-8.3012.30-13.30)?
First, you have to have a field to record the time. Assume that the field belongs to date-time type and is named [create _ time];
Then, you can use the datepart function to get the value of year, month, day, hour, minute and second of a time type;
Finally, you can convert hour:minute to a type with a decimal for comparison, such as numeric (4,2).
select * from ...
Where date part (month, update time) =4.
Instead of datepart(hour, create _ time)+convert (numeric (4,2), datepart(minute, create_time))/ 100 is between 7.3 and 8.3.
Instead of datepart (hour, creation time) +convert (number (4,2), datepart (minute, creation time))/100 is between 12.3 and 12.3.
- Previous article:September 20th, 2023 is the auspicious day of the ecliptic.
- Next article:65438+February, an auspicious day of the zodiac in 2023.
- Related articles
- How about having sex in the morning?
- What does the afternoon rain mean?
- This year's zodiac sign
- Calendar Old Yellow Calendar 9
- What does the dragon on the tap mean?
- 202 1 September bathing auspicious day query list
- Fu Wei's dream of canned food in soft packaging.
- 202 1. View the old almanac
- Huang Li's resignation is auspicious.
- 1962 the first day of the winter moon, what month is the national calendar, please?