Reputation: 167
I have these tables
DataType
Name TableName
-------------------
Animal dataAnimal
Vehicle dataVehicle
dataVehicle
ID Name Speed
-------------------
1 Car 10
2 Bike 2
3 Horse 4
dataAnimal
ID Name ImageFile
-----------------------------
1 Cow cow.jpg
2 Sheep sheep.jpg
3 Pig pig.jpg
Is it possible to make a relationship with datatype column TableName
and all the tables with that name?
Upvotes: 0
Views: 136
Reputation: 499062
No it is not possible in just about any SQL database.
Relations, table and column names are not dynamic - the only way to query based on this structure is to use Dynamic SQL, which is complex and comes with dangers like SQL Injection.
You need to rethink your design or choice of persistence technology.
Upvotes: 2