SQL Datename within a function

70 views Asked by At

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

1

There are 1 answers

0
PAPERCLIPSANDPAPER On BEST ANSWER

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