Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2008-10-13
8
Medium Priority
?
302 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
8 Comments
 
LVL 15

Accepted Solution

by:
jorge_toriz earned 150 total points
ID: 22707806
Well, the views cannot be parametrized, that is the first point, in that case you must use tabular functions
0
 
LVL 41

Expert Comment

by:Sharath
ID: 22707820
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
ID: 22707881
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
Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

 
LVL 15

Expert Comment

by:jorge_toriz
ID: 22712921
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
ID: 22798849
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
ID: 22798891
But http:#22707806, http:#22707881 and http:#22707820 gave good responses.
0
 

Author Closing Comment

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

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

670 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