In a table called pacientes
I have a Juan
, which is varchar (4)
.
My if
has the following drawback Juan
can be Pedro
or José
. In other words, this name can vary an infinite number of times. I need one IF
that enters Begin
if it Select
shows a result.
The following IF
shows I think only alpha-numeric in>0
I want that if it select
shows 'X' of result enter in Begin
, what I had will be something like this
IF (SELECT Nombre FROM Tabla WHERE CEDULA)>0
BEGIN
PRINT 'Entro'
END
ELSE
PRNT 'NO ENTRO'
Understand that for me I think that >0
"Greater than 0" means Show number of Rows Shown or am I wrong? or shows if the number of select
is greater then it enters?
How would it be spelled correctly?
I made this #Temp (Temporary Table) to see how it goes but it didn't work for me.
CREATE TAble #Temp
(
NOMBRE varchar (250)
)
INSERT #Temp Values ('Juan');
IF (SELECT Nombre FROM #temp)>0
BEGIN
PRINT 'EXITO'
END
ELSE
PRINT 'NO EXISTE'
Very important the word juan
are combinations of the AZ that is thousands of combinations
I mean I want a solution to the line
IF (SELECT Nombre FROM #temp)>0
I took this as a varchar and not as an int
To know the number of rows returned by a select , you would use the function count(*)