In reference to my question I am trying this select statement and getting error
Select * From
(SELECT * FROM FruitCrate WHERE FruitName IN (' +@FruitNames+ '))
WHERE FruitCrate.Eatable= 1
Error
Incorrect syntax near the keyword 'WHERE'.
Edit
USE [DataBaseName]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[SPName]
(
@FruitNames
)
AS
exec('SELECT *
FROM FruitCrate
WHERE FruitName IN (' +@FruitNames+ ')
and Eatable = 1')