I would jump at your explanation but for the fact that most if not all our joining and whereing is done using fields/parameters of duplicate type and size.
The following code will get you the Logical name of the Database. I believe you have sufficient info in earlier replies to use this to construct the recover query.