Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 help with string manipulation

Author  Topic 

dardar
Starting Member

10 Posts

Posted - 2012-05-10 : 03:32:23
hi guys. need help with the following scenario:

i got a table with 1 column which is a string . foe example:

"name=xxx gender=M pass=abcde" //for table A
"name=yyy gender=M pass=a456" //for table b

and lets sany i have alot of tables like those.

i need to find a way to delete only the "pass" value from each table with a 1 sql query (i.e 1 query which i will run on every DB)

the result should be:
"name=xxx gender=M pass=" //for table A
"name=yyy gender=M pass=" //for table b

thx for the help!

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2012-05-10 : 05:22:05
Look up PATINDEX() to see how you would go about finding the starting point for your query, then you could use CHARINDEX starting at this point to find the next ", this would give you a start and end position, you could then SUBSTRING() everything before and after these points.
Go to Top of Page
   

- Advertisement -