Friday, 31 July 2015

Create a View in MS Sql Server 2008 R2

How to Create and Displaying a View 

      wel-come again, i come with my Third post, in this post i explain about the how to create a view in Sql Server 2008 R2. in my previous post i explain about how to create database and table and how to open and display table.Create a Database in MS Sql Server 2008 R2 read more about this

     let's start with first open Sql Server Management studio and login with your user name and password after login, left pan display to list of database expand the database display the list of folder in this list of folder select the View folder.

View >> Right click >>New view



Display the window "Add Table" in this window list of all the table are there database,you can select one or more table from here look like this...


select table >> click on add button
all the add table display in the query window



you can select the field in the table using check box display right site of every field, check the list of field you want to include in view,it generate three view first is select field you want, second the detail description of all the selected field and the last display the generate select query for selected field.


Complete the query and after save the view using CTRL+S or file >> save
Display the "Chose Name" window to enter the name of the view and the click on OK to create view successfully .



view is display in view folder to display in the left Pan ,view all the list of create view and display the column congaing in the view after complete the step to display the view result in the right pan


SELECT TOP 1000 [ID]
      ,[Name]
      ,[Address]
      ,[Phone]
  FROM [EMPDB].[dbo].[View_Name]

it query display the result of top 1000 record on the right pan window

           OR

SELECT     ID, Name, Address, Phone
FROM         View_Name


it query display the result of All record on the right pan window


 i complete this post from now, i hope this is my post help for everone who starter or new on the sql server , any query and any type of confusion regarding this post please comments me so i help to learn more about this topic

Thanks

krunal patel

:-) :-)

My Popular post click on Link to view


3 comments: