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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-03-09 : 08:35:43
|
| Jorge writes "Hello.I'm sorry if this is basic but I was assigned the task of building a simple report generator and everything was going ok with Access until they told me we would had to support Sql Server.My problem: in Acces I create 2 views with parameters .The first view uses the second view in its sql statement (both work with parameters).So i set the parameters values and call the first view (and everything works out just fine).Now, in Sql Server a view with parameters in considered to be a stored procedure (right?!) so how can I do something like this:Query1SELECT * FROM QUERY2 WHERE ID=@parm1QUERY2SELECT * FROM XXx,xxx,xxx .... WHERE InitialDate=@parm2Once again: in Acces I'm able to set the parameter values and run query1.So the mai question is : how can I call a stored procedure so I can replicate these two queries?Thanks very much for your attention and help.Best Regards,Jorge C.rdc02271@yahoo.com" |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-03-09 : 08:43:45
|
| If you want to keep separate stored procs thenCreate a temp tableinsert #aexec s_QUERY2 @parm2select ...from ...join #a on ...where ID=@parm1and ...But you can probably combine into a single SP queryselect *from (select * from tbl where ID = @Parm1) awhere ID2 = @Parm2==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|