简体   繁体   中英

SQL Datename within a function

I'm having issues when trying to get a datename Month within a conversion.

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.

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.

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],

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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