I'm writing a stored procedure in SQL Server and I need to insert a value into DATETIME
column with input of MONTH
and YEAR
.
Example: Input MONTH = 7, YEAR = 2023, the result is:
| DATETIME |
| ------------ |
| 2023-07-01 00:00:00.000 |
The DAY value is 01 when insert new record.
1条答案
按热度按时间jjjwad0x1#
I got the answer. Use function
DATEFROMPARTS(@Year, @Month, 1)