![]() ![]() Local_date:=cast(from_tz(cast(utc_date as timestamp), 'UTC') at time zone ‘America/Los_Angeles’ as date) īelow is an example of a C# SQL CLR function that will convert the specified UTC time to local time. The function returns the local time taking the UTC time as the input.Ĭreate or replace function displayLocalTime(utc_date in date) In the view definition the function displayLocalTime is used as follows in Oracle. Used should provide good performance (Oracle function is provided below for reference). ![]() But the issue is that this UDF is not deterministic.Ĭan we get a deterministic function or alternate recommendation to convert UTC time to local time and vice versa in MS SQL database which when To convert UTC time to local time in SQL Server. But Indexed views work only with deterministic functions. We can only consider indexed view approach. We cannot consider computed column approach because of the fact that it becomes database specific and our product should support both Oracle We can achieve function based index feature in MS SQL with two ways: We need Oracle’s function based index equivalent in MS SQL database or other approaches to handle this situation. ![]() We’ve used the function based index approach to improve performance of the queries, hitting those views. Currently, in oracle views, we are using oracle specific functions to convert UTC time to local time. We have certain tables with date time column (time saved as UTC). We want to migrate data from oracle database to MS SQL database.
0 Comments
Leave a Reply. |