T SQL Date format convert function

Here is reusable function which can be used to format SQL dateTime to any format like C# or VB.net DROP FUNCTION dbo.fnFormatDate GO CREATE FUNCTION dbo.fnFormatDate (@Datetime DATETIME, @FormatMask VARCHAR(100)) RETURNS VARCHAR(100) AS BEGIN DECLARE @StringDate VARCHAR(100) SET @StringDate = …

T-SQL Date Format Function – fnDateFormat like .net Read more »

T SQL Date format convert function

Consider scenario where you want to populate missing data from previous date when data was available. In the following example we want to populate price of orders from most recent previous date when price was available. create table #orderinfo ( …

How to backfill data using SQL – populate missing values from historical data Read more »