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 have always appreciated the absolute best tech support that AccuZIP gives us. Your whole team is great.
L.W., Tampa, FL