x002548's Blog

Not Just a Number - Brett Kaiser
posts - 89, comments - 586, trackbacks - 39

November 2009 Blog Posts

Parsing String in SQL Server Hack

Alrighty Then How to Parse a string in SQl...not always easy...I imagine it really shouldn't have been difficult for M$ to make some T-SQL extensions, but they didn't (or at least up to 2k5...gotta look more into 2k8) Even in REXX we had some nice features...like MASK, WORD, WORDS, etc. So SQL Server Database devloper slaves are usually left with a myriad of slick hacks..REVERSE, CHARINDEX (to the nth degree), and ultimatley looping with logic in a User Defined Function (UDF) In any case, we had an OP in this thread, "Parse String, Extract Multiple Parts of a Sting" ask how to parse out...

posted @ Friday, November 20, 2009 12:45 PM | Feedback (2) | Filed Under [ SQL Server ]

Replace a Character Anywhere in a DB

Ran across this thread http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=135575 And figured I'd post this.  The code below will generate update statement for all tables that have a char data type.  It will then replace a quote (") with an empty sting Guess you could automate this, but this is simple enough.  Just cut and paste the results and execute that.  I guess you could go on and schedule it to run nightly to do a clean up. Hope you have a backup BEFORE you run the result set CREATE TABLE #myTemp99 (n int IDENTITY(1,1), TABLE_NAME varchar(256), COLUMN_NAME varchar(256)) GO INSERT INTO #myTemp99(TABLE_NAME, COLUMN_NAME)      SELECT TABLE_NAME, COLUMN_NAME         FROM INFORMATION_SCHEMA.Columns      ...

posted @ Monday, November 09, 2009 3:03 PM | Feedback (0) | Filed Under [ SQL Server ]

Powered by:
Powered By Subtext Powered By ASP.NET