good day,
i have a table named information
i created a stored procedure that will search for thier name, "firstname","middlename" and "lastname"
that 3 field is concatenated and named it fullname
My problem is that i want to count the result of my query that count the total number of return based on my condition. and if the result does not return a value, the message should be "RECORD NOT FOUND!"
here's my sample query for search
SELECT
MRN
,CONVERT(DATE,BIRTHDATE)BIRTHDATE
,FIRSTNAME +' '+MIDDLENAME+' ' +LASTNAME as FULLNAME
,GENDER
,MARITAL_STATUS
,RELIGION
,OCCUPATION
,ADDRESS1
FROM [dbHIS].[dbo].[PATIENT_INFORMATION]
WHERE (FIRSTNAME LIKE @FIRSTNAME OR @FIRSTNAME IS NULL)
OR (LASTNAME LIKE @LASTNAME OR @LASTNAME IS NULL)
OR (MIDDLENAME LIKE @MIDDLENAME OR @MIDDLENAME IS NULL)
hope that some will help me.. thanks