A simple UDF from reader Ashish Jain that removes duplicate entries from a comma delimited string by turning it into a table and using DISTINCT.
SQL SERVER – Find Number of Rows and Disk Space Reserved – Using sp_spaceused Interesting Observation
sp_spaceused shows the row count of a table and the disk space reserved. Here is why its numbers looked wrong on AdventureWorks and how @updateusage fixed them.
SQL SERVER – Retrieve – Select Only Date Part From DateTime – Best Practice – Part 2
Which way to select only date part from DATETIME is faster? After more tests on large tables, I now suggest the DATEADD and DATEDIFF method over CONVERT.
SQL SERVER – Get Numeric Value From Alpha Numeric String – UDF for Get Numeric Numbers Only
A simple UDF that gets only the numbers from an alpha numeric string, using PATINDEX and STUFF, with test values for empty, NULL and mixed strings.
SQL SERVER – 2008 – Enhenced TRIM() Function – Remove Trailing Spaces, Leading Spaces, White Space, Tabs, Carriage Returns, Line Feeds
Need to remove trailing spaces, leading spaces, tabs, carriage returns and line feeds? Here is an enhanced TRIM function built from a script by Russ and Erik.
SQL SERVER – 2008 – TRIM() Function – User Defined Function
SQL Server 2000, 2005 and 2008 have no TRIM() function, but LTRIM and RTRIM together do the job. Here is a simple UDF that trims both sides at once.
SQL SERVER – Get Answer in Float When Dividing of Two Integer
Dividing one integer by another in SQL Server returns an integer. Use CAST or CONVERT to get the answer in float, with decimals, as this example shows.






