You didn't enclose value into quotes to create a string literal. I also prefer to create dynamic sql into local variable. I can output it to see how it looks and troubleshoot problems
DECLARE @sql varchar(4000)
SET @sql = 'select * from Kunden where ' + @cFeld + '=''' + @cSUCH + ''''
execute(@sql)
>I'm quite new to this and tried out the following:
>
>
>USE [wlsql2007]
>GO
>/****** Objekt: StoredProcedure [dbo].[spksuche] Skriptdatum: 10/06/2007 20:37:41 ******/
>SET ANSI_NULLS ON
>GO
>SET QUOTED_IDENTIFIER ON
>GO
>
>create proc [dbo].[spksuche]
> @cFeld varchar(15),
> @cSUCH varchar(15)
>as
>execute('select * from Kunden where '+@cFeld+'='+@cSUCH)
>
>where cFeld is the Field Name
>and cSuch is the word to be looked for.
>
>but I do not receive results.
--sb--