Skip to main content

Posts

Showing posts from June, 2023

MYSQL data time conversion with datetime Offset in MSSQL Server

 The following will update the date time to your servers system date time adjusted with correct time offset. Select   CONVERT(datetime,                 SWITCHOFFSET(CONVERT(datetimeoffset,                                     MYSQLDateField),                              DATENAME(TzOffset, SYSDATETIMEOFFSET()))) as UpdatedDate from YourMYSQLtable;

Converting JSON Key-Value Pair Dataset into HTML

-- Convert JSON Key-Value Pair Dataset into HTML -- -- Function: fnJsonToUlList -- Author: KrishanG -- Date: 13/06/2023 -- Description: Converts a JSON key-value pair dataset into an HTML unordered list (UL) -- Example usage of the @json parameter: -- SET @json = '{"Title":"Mrs","FirstName":"Grace","LastName":"Gibbs","SurnameAtSchool":"Miles","email":"gibbs@outlook.com","PhoneNumber":"0402 935 000","YearLeft":"2013","ContactYesNo":"No","ProfTopic":"N\/A","MoreDetails":"N\/A"}' -- ================================================ -- Function Definition -- ================================================ ALTER FUNCTION fnJsonToUlList ( -- Parameters @json nvarchar(max) ) RETURNS nvarchar(max) AS BEGIN -- Variable declaration DECLARE @Result nvarchar(max) -- C