SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 parametric sql
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

casati74
Posting Yak Master

Italy
109 Posts

Posted - 01/31/2007 :  05:56:54  Show Profile  Reply with Quote
It is possible pass a parameter to a view????


es:


create view test

@var1
@var 2

select * from table 1
where column1 = @var1 and column2 = @var2
union all
select * from table 2
where column1 = @var1 and column2 = @var2
union all
..........



Thank's

SwePeso
Patron Saint of Lost Yaks

Sweden
30217 Posts

Posted - 01/31/2007 :  06:00:22  Show Profile  Visit SwePeso's Homepage  Reply with Quote
No.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

harsh_athalye
Flowing Fount of Yak Knowledge

India
5509 Posts

Posted - 01/31/2007 :  06:13:32  Show Profile  Visit harsh_athalye's Homepage  Click to see harsh_athalye's MSN Messenger address  Send harsh_athalye a Yahoo! Message  Reply with Quote
But you can create Inline table valued function to do this:

Create Function test
(@var1 varchar(10), @var2 varchar(10))
Returns Table
as
Return(Select * from table1 where col1 = @var1 and col2 = @var2
       union all
       ...
       )


Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

casati74
Posting Yak Master

Italy
109 Posts

Posted - 01/31/2007 :  06:20:49  Show Profile  Reply with Quote
Ok also for me the functions is the only one solution!!!

But i spoke with one people that ha said me there is a possible to create a parametric view!!!

Thank's
Go to Top of Page

spirit1
Cybernetic Yak Master

Slovenia
11750 Posts

Posted - 01/31/2007 :  06:28:11  Show Profile  Visit spirit1's Homepage  Reply with Quote
he told you wrong.



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000