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 just wanted to let your team know how much I appreciate you. I'm still fairly new at doing mail data processing, and it if weren't for your active support -- even for the not so smart questions -- I probably wouldn't be doing as well in this job as I am now. I have much more to learn as I have seen, but I just wanted to say thank you for your help! You all are wonderful!
T.B., Greenville, SC