Store Procedure

14/04/2004 - 00:33 por Mercedes | Informe spam
Saludos:
Alguien me puede asesorar con respecto a esta sección de
mi procedure
IF ('SELECT count(*) FROM ' + @Tb_name ) = '0'
BEGIN
PRINT 'No hay valor'
END
ELSE
BEGIN
PRINT 'Si hay valor'
END

Me manda este mensaje de error:

DTEFAC2
Server: Msg 245, Level 16, State 1, Line 32
Syntax error converting the varchar value 'SELECT count(*)
FROM DTEFAC2

De antemano, gracias
 

Leer las respuestas

#1 Gustavo Larriera [MVP SQL]
14/04/2004 - 00:41 | Informe spam
COUNT retorna un número, pero lo estás comparando contra '0' en vez de
contra 0.

Gustavo Larriera, MVP-SQL, MCSE
Uruguay LatAm
Este mensaje se proporciona "COMO ESTA" sin garantias y no otorga ningun
derecho / This posting is provided "AS IS" with no warranties, and confers
no rights.
"Mercedes" wrote in message
news:1c64a01c421a7$622f5260$
Saludos:
Alguien me puede asesorar con respecto a esta sección de
mi procedure
IF ('SELECT count(*) FROM ' + @Tb_name ) = '0'
BEGIN
PRINT 'No hay valor'
END
ELSE
BEGIN
PRINT 'Si hay valor'
END

Me manda este mensaje de error:

DTEFAC2
Server: Msg 245, Level 16, State 1, Line 32
Syntax error converting the varchar value 'SELECT count(*)
FROM DTEFAC2

De antemano, gracias

Preguntas similares