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 |
|
djpaz25
Starting Member
4 Posts |
Posted - 2003-08-26 : 13:07:07
|
| I'm converting an Access DB to SQL Server. In Access, I have Param1 in Query1, and fields from Query1 as part of Query2. I can pass the parameter to Query2 and it all works.In SQL Server, am I correct in understanding that only Stored Procedures may have parameters and only Views may refer to other views? If this is so, is there a way to combine these? |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2003-08-26 : 13:30:53
|
| Stored procedures and functions can have parameters.Any query can refer to a view.A query in an SP can refer to a view (in most places a view can be used in place of a table) but a view cannot refer to a stored proc - but it can use a function.==========================================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. |
 |
|
|
djpaz25
Starting Member
4 Posts |
Posted - 2003-08-26 : 14:26:25
|
| Is there any way to do the following:SELECT Field1A, Field1B FROM Table1WHERE Field1A = @Param1(Call this SP1)Combined withSELECT SP1.Field1A, SP1.Field1B, Table2.Field2A, Table2.Field2BFROM SP1 INNER JOIN Table2 ON SP1.Field1B = Table2.Field2BI need to both pass a parameter and refer to another SP/View. |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2003-08-26 : 15:50:03
|
| You can use a temp tableinsert #a exec sp1select ...from #a, tbl ...Or use a table valued function instead of sp1.==========================================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. |
 |
|
|
|
|
|