SQL One视图表,其中包含数据库中的所有表 [英] SQL One view table with all tables included in database
问题描述
您好我遇到了麻烦 定制 我们的MS SQL数据库。
我的问题是:
是否可以创建一个包含数据库中所有表的视图表? br />
我在数据库中看到的是带有相同名称列的表格。
当我尝试创建包含这两个表的基本视图表,这些列我收到错误,因为一个列在两个表中具有相同的名称。
Hello I am in trouble with customizing our MS SQL Database.
My question is:
is it possible to create one view table with all tables included in the database?
I see in our DB we are with tables with the columns with the same names.
And when I tried to create basic view table included this two tables with these columns I received error because one column is with the same name in the two tables.
推荐答案
抱歉没有理解你的问题
Sorry didnt understand your question
你能详细说明吗?
您是否尝试在视图中合并多个具有相同列的表中的数据?
Are you trying to merge data from multiple tables with identical columns inside a view?
然后你应该这样做
CREATE VIEW vw_ViewName
AS
SELECT Column1,Column2,...
FROM Table1
UNION ALL
SELECT Column1,Column2,...
FROM Table2
UNION ALL
SELECT Column1,Column2,...
FROM Table3
UNION ALL
....
GO
这篇关于SQL One视图表,其中包含数据库中的所有表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!