Found this is microsoft official line on creating a singleton, much simpler than the normal GOF way
// .NET Singleton
sealed class Singleton
{
private Singleton() {}
public static readonly Singleton Instance = new Singleton();
}
Just a little udf that gets midnight for a datetime.
CREATE FUNCTION dbo.Midnight (@Date datetime)
RETURNS Datetime AS
BEGIN
return CAST(FLOOR(CAST(@Date AS FLOAT)) AS DATETIME)
END
Just a couple of udf to handle paths in sql server, not very solid but if your paths are valid they work well.
CREATE FUNCTION dbo.GetFileName (@Path varchar(512))
RETURNS varchar(255) AS
BEGIN
Return RIGHT(@Path, LEN(@Path) - dbo.LAST_INDEX(@Path, '\'))
END
Read more…