Solved

How do you create a view using MS SQL server Management Suite

Posted on 2008-10-13
8
295 Views
Last Modified: 2013-11-16
Need to utilize an outer join and user date paramter, therefore creating a view to provide the user to query with a date paramter.
0
Comment
Question by:bradleydandrews
  • 2
  • 2
  • 2
  • +1
8 Comments
 
LVL 15

Accepted Solution

by:
jorge_toriz earned 50 total points
Comment Utility
Well, the views cannot be parametrized, that is the first point, in that case you must use tabular functions
0
 
LVL 40

Expert Comment

by:Sharath
Comment Utility
You can create a view in SSMS by right click on Views folder in your database. A window will be opened, from where you can pick existing tables/views/Functions/Synonyms for the creation of your view.

>> therefore creating a view to provide the user to query with a date paramter.
If you want to pass a date parameter in the SELECT query of your view, you can create a stored procedure and pass the date as parameter.
0
 
LVL 39

Expert Comment

by:BrandonGalderisi
Comment Utility
http:#22707820 is correct.  You can't really use a view for this.  You would want to create a procedure.



create procedure up_MyProc

 @DateParam datetime

as

set nocount on

select t1.col1, t2.col2, t3.col3

from table1 t1

join table2 t2 

on t1.id=t2.id

join table3 t3

on t2.id2 = t3.id2

where t3.YourDateField = @DateParam

go
 

--then execute it like this:

exec up_MyProc '20081013'

Open in new window

0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 15

Expert Comment

by:jorge_toriz
Comment Utility
I prefer to use tabular functions, if you want to join your query results you will have to do some more work if you use stored procedures.

Tabular functions are made for that... stored procedures are used to perform changes in databases... is the common sense
0
 

Author Comment

by:bradleydandrews
Comment Utility
Not having a solid SQL background, I chose to create an Excel Pivot Table built on an OLAP cube. The user then can alter the date inclusion using the page dropdown.
0
 
LVL 39

Expert Comment

by:BrandonGalderisi
Comment Utility
But http:#22707806, http:#22707881 and http:#22707820 gave good responses.
0
 

Author Closing Comment

by:bradleydandrews
Comment Utility
I agreed with the solution, however the answer clearly begged for another question.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Join & Write a Comment

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now