The following are examples of T-SQL coding. I've placed this here both for others to review and also for me to have a central place I can store my coding examples. Remember, your memory is the second thing to go. Some of these clipits were taken from other peoples examples and some where written by me and were tested/used using SQL Server 2005 and 2008. I do not claim to have authored these examples. When available or possible, I have tried to give credit to the original author. Also, use these examples at your own risk. I do not claim the accuracy of these examples. All I know is that they help me from time to time in my development.

SQL Queries
  • NewExamples of random SQL Queries to accomplish specific tasks using SQL Server or Microsoft Access. (Examples)
SQL Scripts
  • NewRebuild_Indexes.sql - Rebuild all indexes for all tables in a database. (Source)
Stored Procedures:
  • usp_DirFolder - Returns the filenames contained in the passed Folder name. (Source)
Table-Valued Functions:
  • uft_ParseString - Returns a table with parsed elements in a passed string. (Source)
  • uft_ReadFileAsTable - Returns a table with each line from the text file written to a row in the table. (Source)
Scalar-Valued Functions:
  • ufs_URLDecode - Returns decoded URL line. For example, %20 is replaced with a space. (Source)
  • ufs_URLEncode - Returns encoded URL line. For example, all spaces are replaced with %20. (Source)
  • ufs_URLSite - Returns Web Site name from a URL line. (Source)