Tag Archives: UDF

Writing Your Own Search Engine Using SQL Server

My coffee site INeedCoffee needed a better search engine. I had thrown some basic SQL together when the site was launched back in 1999. It did an OK job when the site didn’t have much content. Over the years, the … Continue reading

Posted in SQL | Tagged , , | 1 Comment

Convert Hexadecimal to Integer in SQL

Below is a handy function for converting a hexadecimal value into an integer using a SQL Server user defined function. IF OBJECT_ID(‘dbo.udfHex2Int’) IS NOT NULL DROP FUNCTION dbo.udfHex2Int GO CREATE FUNCTION dbo.udfHex2Int ( @hexstr AS varchar(1000) ) — Function converts … Continue reading

Posted in SQL | Tagged , | Comments Off

Date Scrubbing Function for SQL Server

When creating a report often the date column provides more detail than we need to see. Here is a handy little UDF that rounds a DATETIME column to either the MINUTE, HOUR, DAY, WEEK or MONTH. DateFirst UDF IF OBJECT_ID(‘dbo.udfDateFirst’) … Continue reading

Posted in SQL | Tagged , | Comments Off