2024-09-05SQL Server 自定义函数返回格式化DateTimeCreateFUNCTION[dbo].[FormatDateTime](@dateasdatetime,---传入时间@dformatasvarchar(10)---传入要生成的格式代码)RETURNSvarchar(100)ASBEGIN declare@datestringasvarchar(100) if@dformat='f1' begin set@datestring=(SELECTFORMAT(@date,'