Support 805.461.7300
Sales
Our Technology. Your Success.

Add Database name to a field in your database

To create a field in your database, you can use the command:

ALTER TABLE (ALIAS()) ADD COLUMN filename C(20)

Add Column filename C(20) describes the name of the field (filename) the type of field (C for Character) and the width of the field (20 characters).
Then to add the database name to that field, use this command:

REPLACE ALL filename WITH SUBSTR(DBF(),RAT("\",DBF())+1)

DBF() is the complete path of your database. This takes everything from the first character right after the right-most backslash, which is the name of the database without any of the path, and puts it in to a field name called filename for every record in the list.
When you combine the two commands, you have a command that adds a field name then fills the database name into that field:

ALTER TABLE (ALIAS()) ADD COLUMN filename C(20) REPLACE ALL filename WITH SUBSTR(DBF(),RAT("\",DBF())+1)

« Back to Commands

I got a virus and had to have my computer practically rebuilt resulting in losing my custom settings, etc. I just finished an online remote session with Geoff. He was amazingly helpful, patient and upbeat. He spent over 1½ hours with me. Not only did he help me with what I asked him for, he gave me a lot of additional information making my mailing process easier. I've been using AccuZIP for years now and have never taken the time to commend the company for its excellent customer service. I have had good experiences with all of your techs and will absolutely recommend you to anyone I know who needs this kind of software. Thank you for such a user-friendly, customer friendly program!
S.F., Kansas City, MO