0

I have a query which is taking more than 10 minutes to run. I found that the query was slow since there are few functions in the SELECT statement that we are using to convert the UTC to Central Time. I am not able to re-write the existing functions to inline table-valued functions so that I can join the function with other tables. And I am also not able to use 'AT TIME ZONE' since we are using SQL server 2012. Is there any other option to avoid the scalar function in order to convert the UTC time to CST so fast?

  • Other than just expanding the function's expression in the query (i.e. don't use the function), no. This is why you avoid scalar-valued functions like the plague (prior to 2019). – Jeroen Mostert Feb 09 '20 at 20:53
  • follow this link : https://stackoverflow.com/questions/8038744/convert-datetime-column-from-utc-to-local-time-in-select-statement – Narayan Yerrabachu Feb 09 '20 at 21:12

0 Answers0