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 2000 Forums
 SQL Server Development (2000)
 SQL Question

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-06-21 : 14:02:14
Nik writes "Is it possible to perform the following without having to use sp_executesql?

CREATE PROCEDURE my_stored_procedure
@RowIds nvarchar(600)
AS
DECLARE @Sql nvarchar(700)

SET @Sql = N'Select * From MyTable
Where MyTable.RowId In (' + @RowIds + ')'

EXECUTE sp_executesql @Sql
GO


Is this already the best way to do it or could I use something along the lines of (which obviously doesn't work as it is):

CREATE PROCEDURE my_stored_procedure
@RowIds nvarchar(600)
AS
Select * From MyTable
Where MyTable.RowId In (@RowIds)
GO


TIA
Nikki Long
Systems Developer
Meniscus Systems Ltd"[/i]
   

- Advertisement -