In this SQL Server 2012 tutorial I will show you how create view with syntax using Microsoft SQL Server Management. For the purpose of this tutorial I will use AdventureWorksDW2012.
Other Versions of SQL Server:
- SQL Server 2012
- This blog post has been written using SQL Server 2012
- SQL Server 2008 / R2
- The examples we used should work in SQL Server 2008 and R2
- SQL Server 2005
- We suspect that this will work in SQL Server 2005 as well
In Management Studio I will use AdventureWorksDW2012. Next we have to click Tables and select dbo.DimCustomer.
Picture below show us this steps.
At the beginning of this example we have to create a New Query. You have two options to select AdventureWorksDW2012. You can select from the drop down box or you can use statement.
At the new Query I select use and drag AdventureWorksDW2012. Now, I will show each steps in this Query.
Below the use AdventureWorksDW2012 I type: GO, below CREATE VIEW and vCustomer.
In the next steps I will type AS and below I will type condent of this View - type SELECT and drop from Column Title, FirstName and LastName.
Next I will type FROM and drop dbo.DimCustomer. I execute a Query and in a message box our Query should be Execute successfully.
In the View folder we should see our new view. If you cannot see this just click at the folder View and refresh - now It should be right.
I hope this SQL Tutorial was helpful.
Katie and Emil