Solved

Create View from Complex SQL query

Posted on 2006-11-10
4
309 Views
Last Modified: 2012-06-27
I have a complex sql query that I'd like to create a view for.  I went to views, create view and copied the query into it.  But it won't let me pass the @variable that I need there.  How do I do this?  Basically, whenever I use the view, I would have that parameter being passed in.

Thanks.
0
Comment
Question by:YLaw
4 Comments
 
LVL 11

Accepted Solution

by:
regbes earned 500 total points
ID: 17916980
Hi YLaw,

you will need to create a stored procedue or a tabled valued function as views do not support parameters

0
 

Author Comment

by:YLaw
ID: 17916985
Thanks.
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 17916988
YLaw,
>  How do I do this?
Views are nothing but virtual tables, you can't pass variables. You can either go for a function or a stored procedure
0
 
LVL 29

Expert Comment

by:QPR
ID: 17917001
create procedure owner.spname
@variable datatype
as
paste here
Go
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

747 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

7 Experts available now in Live!

Get 1:1 Help Now