Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Need to add two parameters into VIEW

Author  Topic 

ziskad
Starting Member

1 Post

Posted - 2007-07-25 : 06:10:57
Is there any way to send two parameters:
PARAMETER_dateFrom
PARAMETER_dateTo
into my view (see below) called from outside?

I expect query like this:
select * from v_customFieldString where bug.id = XXXX and send in some way PARAMETER_dateFrom, PARAMETER_dateTo

create or replace view v_customFieldString as
select bug.id
,histold.bug_id as bugId
,bug.project_id as projectId
,histold.date_modified as date
,histold.old_value as oldvalue
,histnew.new_value as newvalue
from mantis_bug_table bug
left
join mantis_bug_history_table histold
on histold.bug_id = bug.id
and histold.date_modified =
(select min(date_modified )
from mantis_bug_history_table where bug_id=bug.id and field_name='Duration' and date_modified >= PARAMETER_date FROM and date_modified<= PARAMETER_dateTo )
and histold.field_name='Duration'
left
join mantis_bug_history_table histnew
on histnew.bug_id = bug.id
and histnew.date_modified =
(select max(date_modified )
from mantis_bug_history_table where bug_id=bug.id and field_name='Duration' and date_modified >= PARAMETER_date FROM and date_modified<= PARAMETER_dateTo)
and histnew.field_name='Duration'

pootle_flump

1064 Posts

Posted - 2007-07-25 : 06:15:40
No. You'll need to use a table valued function or stored procedure to do this.
Go to Top of Page
   

- Advertisement -