SQL Server 2000General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Just for clarification. Do you want to replace from a specific list like (yahoo.com, hotmail.com, micro$oft.com) or ALL (*.com, *.net, *.org) type values? Because the second option is much more difficult.
Ok then in that case I suggest you do in in the front end app like suggested above. If you do it in SQL I suggest the below listed process. But I suggest you use both. Filter them in the front end then if new vales you don't like make it to the database. You can remove them and revise the front end with additional exceptions. Create a table of the values you want to exclude. Run a nightly job the compares the exclude list to whats been entered. This is easier than doing the trigger approach but the disadvantage is you allow the saving of the data you don't want until the job is run. The advantage is if you want to grow your list of exceptions it will go back and fix all historical instances of what you don't want. If you want the best of both worlds you could compare against the list in the trigger. But the disadvantage of this is it will be extremely slow. As your list grows the trigger method will also be be slower and slower. Question to ask yourself is can you live with the undesirable data for a period of time. Best solution still is on the front end app. My suggestions are only if you want/have to do it in the backend and to get you to think about the ramifications of the direction you choose.