Dateadd sql server10/31/2022 ![]() ![]() * Common date functions */ -//This contains common date functions for MSSQL server /*Getting Parts of a DateTime*/ -//gets the date only, 20x faster than using Convert/Cast to varchar -//this has been especially useful for JOINS SELECT ( CAST ( FLOOR ( CAST ( GETDATE () as FLOAT )) AS DateTime )) -//gets the time only (date portion is '' and is considered the "0 time" of dates in MSSQL, even with the datatype min value of. ![]() Копите эти удобные конверсии, которые я собрал на протяжении многих лет. In the above t-sql user defined function for creating a sql calendar table, I have used the DATEADD() and DATEDIFF() datetime functions in order to set the first date an last date parameters to show only date values with hour, minute and seconds with 0 values. Let me know what you think of this blog post about Find Business Days. WHERE wkday NOT IN(1,7) When you run the script above it will give results as following: You can specify any other date as a start date and end date and it will give you accurate results. Select DATENAME ( day, myTime ) + SUBSTRING ( UPPER ( DATENAME ( month, myTime )), 0, 4 ) ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |