从SQL Server创建视图 [英] Creating a View from SQL Server

查看:100
本文介绍了从SQL Server创建视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我知道View是另一个表的虚拟表.另外,我无法将值从临时表传递给View.

假设我想使用数据库中的表,但是我想在视图中添加一列而不是表本身,该怎么做?

我想出的唯一方法是创建一个包含所有列的附加表,将原始表传递给该表(这样我将获得所有包含值的列和所需的列),然后传递给视图...

Hi,

I know that the View is a virtual table of another table. In addition I can''t to pass values from a temporary table to a View.

Suppose that I want to use a table from my data base, but I want to add a column in the View instead of the table itself, how I can do that?

The only way that I figured out is creating an additional table which contains all the columns, pass the original to this one (so I will get all the columns with values and the column that I want), and then to the View...

推荐答案

好,在使用视图之前,我还没有尝试过类似的方法,但是我通常要做的是使用临时表#table_name,全局表##table_name或声明的表@table_name,我可以轻松地完成您想做的事情.但是当然,这在很大程度上与我要工作的范围有关,我认为您可能希望在更大的范围内工作.我个人将在视图中进行检查现在!
:)
ok I havent tried something like that before USING a view, but what I usually do is to rather use either a temporary table #table_name, a global table ##table_name or a declared table @table_name and I can easily do what you wanted to do. But of course it largely has to do with the scope within which I want to work in, with views I would assume you would want to work in a larger scope..I''m personally going to check up on doing it in a view now!
:)


这篇关于从SQL Server创建视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆