How can I generate an .mdf file containing a subset of my tables and rows? I need to provide some data to an organisation (lets call them DataCo) that we're working with. Since we're both SQL server shops, my counterpart at DataCo requested an .mdf file.

However, our database contains many tables that DataCo don't need. Moreover, they're only interested in rows from the last X years. For many reasons (inc. file size) I'd like an .mdf file containing only the data that DataCo need.

Is this possible?
With some clever jiggery-pokery with partitioning and filegroups you could get a particular sub-set of your data onto just one of the physical files used by a particular database.  Trying to attach that into an existing database at the recipient would be "challengining", I think.  In 20-some years of doing this stuff I've not heard of anyone trying that.*

My suggestions would be
a) copy your DB, delete the stuff you don't want to pass on, send a backup of that to the recipient
b) use BCP with the queryout option to dump just the required data to external files.  Send those to the recipient.

*I'm always willing to learn, however.