HALO 3

Nothing else to be said. GOOCH

2

SQL Server Function to get the Hour of the Year

This function returns an integer of the hour of the year passed as a variable. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[util].[uf_GetHourOfYear]’) AND type IN (N’FN’, N’IF’, N’TF’, N’FS’, N’FT’)) DROP FUNCTION [util].[uf_GetHourOfYear] GO CREATE FUNCTION [util].[uf_GetHourOfYear]( @date DATETIME ) RETURNS INTEGER WITH EXECUTE AS CALLER AS /********************************************************************************************************** * UDF Name: *…

1

SQL Server Function to get the Hour of the Month

This function returns an integer of the hour of the month passed as a variable. IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[util].[uf_GetHourOfMonth]’) AND type IN (N’FN’, N’IF’, N’TF’, N’FS’, N’FT’)) DROP FUNCTION [util].[uf_GetHourOfMonth] GO CREATE FUNCTION [util].[uf_GetHourOfMonth]( @date DATETIME ) RETURNS INTEGER WITH EXECUTE AS CALLER AS /********************************************************************************************************** * UDF Name: *…

1

SQL Server Function to return half year number of days.

This function returns an integer of the number of days in the half year.   IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[util].[uf_GetHalfYearDays]’) AND type IN (N’FN’, N’IF’, N’TF’, N’FS’, N’FT’)) DROP FUNCTION [util].[uf_GetHalfYearDays] GO CREATE FUNCTION [util].[uf_GetHalfYearDays]( @date DATETIME ) RETURNS INTEGER WITH EXECUTE AS CALLER AS /********************************************************************************************************** * UDF Name: *…

1

SQLCMD and the power of the little r

I would have to say that one of my favorite new utilities that shipped with SQL Server 2005 has been the SQLCMD utility.  I am going to demonstrate the use of include files. The following is the complete call syntax for SQLCMD. sqlcmd [{ { -U login_id [ -P password ] } | –E trusted…

7