Click here to Skip to main content
Licence CPOL
First Posted 12 Dec 2007
Views 8,053
Downloads 17
Bookmarked 12 times

Simple bit of Transact SQL to help locate text in a database

By | 12 Dec 2007 | Article
Simple bit of Transact SQL to help locate text in a database using cursors
 
Part of The SQL Zone sponsored by
See Also

Introduction

This was a littel bit of SQL I wrote to help in a migration project. Quite simply it will go through each table and row looking for your text. It it is found it displays the Table and then does a select of the table.

Background

The code makes use of system tables and Transact SQL Cursors

Using the code

Mainly this code is for interest. Open Management Studio (Or earlier versions), paste the code to a Query Session (logged into your desired database), and then select 'Execute'
            sp_Find_String_In_Database 'Find Text'
        

Note: I have only tested this on 2005, it may need some touching up for 2000 and 7

Points of Interest

On the database I was working on this has (and does) save countless hours of sluthing. Hope it serves you well. Appologies for the pile of errors, they didn't worry me but may you.

History

Orriginal

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

codelion

Software Developer (Senior)
Clear Rock Ltd
United Kingdom United Kingdom

Member

Developing code since the Z80 now works in Southampton doing various projects including Web Applications in .Net. and extensivly using Transact SQL in all sorts of applications.
 
Apart from that Swimming, Cycling, and some Photography

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Layout  Per page   
  Refresh
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120517.1 | Last Updated 12 Dec 2007
Article Copyright 2007 by codelion
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid