April 5, 2008 at 6:15 pm
Select Table.Name as Name,
(Select units from ¿Table.Name? where (¿Table.Name?.Id = Table.Id)) as Units
from Table
where id = 2
The Idea is to use the value of Table.Name in the second Select , depending de tablename stored in the Table.Name.
Tnks in advance
April 6, 2008 at 12:03 am
Only with dynamic SQL.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
April 6, 2008 at 4:38 am
In my case , i need to create a view , do you think is not posible ?
Tks.
April 6, 2008 at 9:53 am
It is possible in a view if you create a column called "TableName". Look at how they do it with the Information_Schema views... particularly the Information_Schema.Columns view.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply