It's going to depend highly on the structure of your
database. You'll need at least:
1. A unique identifier assigned to each 'attachment'.
2. A table to store the identifier and associated
'attachment' name/whatever.
3. A field in the table your 'record' is in to store the
identifier.
You really need to provide some more specifics about your
data/database/app for a more specific answer.