Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Move to a certain record
Message
 
 
À
06/10/2007 14:35:01
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01259127
Message ID:
01259184
Vues:
14
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 + ''''
-- troubleshouting
-- PRINT @sql
-- or
-- SELECT @sql
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--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform