I can do this and it works (but would like something more simple):
Declare @PropIDs varchar(50)
Set @PropIDs = '1, 2'
IF OBJECT_ID('dbo.TempProp') IS NOT NULL DROP TABLE dbo.TempProp
CREATE TABLE [dbo].[TempProp](
[PropCode] [VarChar](3) NULL)
Set @Sql = 'Insert Into TempProp Select PropertyCode From Property where PropertyID In (' + @PropIDs + ')'
Execute (@Sql)
But I wish I could do just this:
Declare @PropIDs
Set @PropIDs = '1, 2'
Select PropertyCode
Into #TempProp
From Property where PropertyID IN (@PropIDs)
It is the "...Property IN (@PropIDs)" that is giving me trouble. Any suggestions?