Réduire
Brouillon
0
18/04/2013
0
You specified an incorrect datatype for the variable containing the 'execute immediate' command string. 
Mots-clés:
SQL Sybase
Utiliser uniquement des variables de type varchar dans la commande EXECUTE
Les variables sont converties dans la commande EXCUTE du type varchar vers le type numeric
ex .:
1. Erreur
   CREATE PROCEDURE ps_test_2 @tableName varchar(10), @runId numeric(18,0)
   AS
   EXECUTE ('SELECT * from ' + @tableName + ' where RunId = ' + @runId)
   => You specified an incorrect datatype for the variable containing the 'execute immediate' command string.
2. OK
   CREATE PROCEDURE ps_test_4 @tableName varchar(10), @runId varchar(18)
   AS
   EXECUTE ('SELECT * from ' + @tableName + ' where RunId = ' + @runId)
   exécution : ps_test_4 'tbRun', '18561'