July 19, 2001

Here's a UDF function for SQL 2000 that will save you datetime headaches when passing datetime variables into your SQL Procedures. The function converts any datetime field to ensure that you don't lose data for the last day to be included.

Here's a simple and straightforward stored procedure that searches a column in a table for words. It can also be easily modified to return all columns rather than just one. The SP was created for SQL Server 2000 but should also work in SQL 7.

Function: Allows to bring back records that contains all words supplied to it. (up to 255 chars total)

The script uses:

  • EXECute to create a dynamic select statement
  • Like and wildcards
  • WHILE loop to construct the dynamic where statement
  • and a couple other simple items everybody asks about
Example: sp00_QueryColumn 'jump the gator','GatorColumn','GatorTable'

would search the column 'GatorColumn' in the 'GatorTable' and
return the following records :

the jumping gator
Jump the magic alligator
the humping jumping gator
the crazy alligator jump
Them dummy alligator jumpers


Author: Anthony Loera

Download Script:

Disclaimer: We hope that the information on these script pages is valuable to you. Your use of the information contained in these pages, however, is at your sole risk. All information on these pages is provided "as -is", without any warranty, whether express or implied, of its accuracy, completeness, or fitness for a particular purpose... Disclaimer Continued

Back to Database Journal Home

The Network for Technology Professionals


About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers