Remove text that precedes "#"

F

fredg

Hello,
I have a string that looks like this:
§74.1321#http://ecfr.gpoaccess.gov/cgi/t/text/text-idx?c=ecfr
rgn=div8&view=text&node=21:1.0.1.1.27.2.31.18&idno=21#

How can I remove the characters that precede the first "#", so that string
will look like this:

#http://ecfr.gpoaccess.gov/cgi/t/text/text-idx?c=ecfr
rgn=div8&view=text&node=21:1.0.1.1.27.2.31.18&idno=21#

I know I'll need an update query.

Thanks in advance for your help.

Ellen

Update YourTable Set YourTable.[FieldName] =
Mid([FieldName],InStr([FieldName],"#")+1)
 
M

MGFoster

EllenM said:
Hello,
I have a string that looks like this:
§74.1321#http://ecfr.gpoaccess.gov/cgi/t/text/text-idx?c=ecfr
rgn=div8&view=text&node=21:1.0.1.1.27.2.31.18&idno=21#

How can I remove the characters that precede the first "#", so that string
will look like this:

#http://ecfr.gpoaccess.gov/cgi/t/text/text-idx?c=ecfr
rgn=div8&view=text&node=21:1.0.1.1.27.2.31.18&idno=21#

I know I'll need an update query.

Thanks in advance for your help.

Ellen


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Probably like this:

UPDATE table_name
SET column_name = Mid(column_name, InStr(column_name, "#http")-1)
WHERE column_name LIKE "*[#]http:*"

Be sure to change "table_name" to your table's name and "column_name" to
the column name in the table.

I put the pound sign (#) in square brackets 'cuz in SQL's LIKE
comparison it represents "any number." The square brackets means
evaluate this character as it is, i.e., don't evaluate it as an "any
number" character.

HTH,
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSmjOFoechKqOuFEgEQKXhQCfTs9Z9Qxyvfk1vh5YpaURU2zriDkAoMm7
gPAIG5Fzhuu3qTFtx8Ppm2Cf
=+oi4
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top