I have the next question. How do I use the wildcart '%' in sybase ? I've trying to create a store procedure to get information like employee names that contain a specific letter OR a pattern, for example a 'C' but when I run the script I only get records which last letter is C. I've done some test like selecting the parameter to see whats receiving and I noticed that when I set a varible with the parameter, the code only puts a wildcart % at the beginning of the string, example:
PARAMETER c
VARIABLE %c
Name FREDIC ISAAC
Here's my code
USE AD06RECHUMBD_DESA
GO
BEGIN TRANSACTION
GO
IF OBJECT_ID ('dbo.pr_EmpleadoPrueba') IS NOT NULL
DROP PROCEDURE dbo.pr_EmpleadoPrueba
GO
USE AD06RECHUMBD_DESA
GO
SET ANSINULL ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].pr_EmpleadoPrueba(
@pNOMBRE CHAR (20)
)
AS
BEGIN
DECLARE @NOMBRE CHAR (20)
SET @NOMBRE = '%' + @pNOMBRE + '%'
SELECT @pNOMBRE AS PARAMETER
SELECT @NOMBRE AS VARIABLE
SELECT A.DES_NOMBRE AS Nombre
FROM RH_EMPLEADO A
WHERE A.DES_NOMBRE LIKE UPPER(@NOMBRE)
ORDER BY A.DES_NOMBRE
END
GO
GRANT EXECUTE ON dbo.pr_EmpleadoPrueba TO user_sirhportal
GO
COMMIT TRANSACTION
GO
What could be the main reason?