简体   繁体   English

函数中的SQL日期名

[英]SQL Datename within a function

I'm having issues when trying to get a datename Month within a conversion. 尝试在转换中获取日期名称Month时遇到问题。

My current query is used to check the time a Trolled passed 'South Shop' however I now require the query to take the conversion then display me the month only. 我当前的查询用于检查Trolled通过“ South Shop”的时间,但是现在我需要查询进行转换,然后仅显示月份。

Current query snippet: 当前查询代码段:

dbo.fn_ConvertUTCtoShopDateTime( Visit.ORGID,
        dbo.fn_GetTrolleyreportcrossingafter ( Visit.ORGID

                                        ,Visit.Trolley_ORGID
                                        ,'South Shop'
                                        , TrolleyMovement.ActualStartDateUTC
                                        , 90
                                       ))                                     AS [Month2],

I understand I can use Datename(mm, but I'm having issues when inserting it into the query. 我知道我可以使用Datename(mm,但是将其插入查询时遇到问题。

any assistance would be fantastic 任何帮助都很棒

Update----- The answer was the following: 更新-----答案如下:

Datename(mm, (dbo.fn_ConvertUTCtoShopDateTime( Visit.ORGID,
        dbo.fn_GetTrolleyreportcrossingafter ( Visit.ORGID

                                        ,Visit.Trolley_ORGID
                                        ,'South Shop'
                                        , TrolleyMovement.ActualStartDateUTC
                                        , 90
                                       ))                                     AS [Month2], 

I apologise for my idiocy 我为自己的愚蠢表示歉意

I apologise but the answer was is as follows: 抱歉,答案如下:

Datename(mm, (dbo.fn_ConvertUTCtoShopDateTime( Visit.ORGID,
        dbo.fn_GetTrolleyreportcrossingafter ( Visit.ORGID

                                        ,Visit.Trolley_ORGID
                                        ,'South Shop'
                                        , TrolleyMovement.ActualStartDateUTC
                                        , 90
                                       ))                                     AS [Month2],

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM