CREATE procedure dbo.buscar
@Desc VARCHAR(255)
,@Tipo VARCHAR(2)
AS
BEGIN
IF UPPER(@Tipo) = 'T'
BEGIN
SELECT
NAME
FROM
SYSOBJECTS
WHERE
ID IN (SELECT
ID
FROM
SYSCOMMENTS
WHERE
TEXT LIKE ('%' + @Desc + '%')
)
ORDER BY
NAME
END
IF UPPER(@Tipo) = 'C'
BEGIN
SELECT
NAME
FROM
SYSOBJECTS
WHERE
ID IN (SELECT
ID
FROM
SYSCOLUMNS
WHERE
NAME LIKE ('%' + @Desc + '%')
)
ORDER BY
NAME
END
SELECT
NAME
FROM
SysObjects
WHERE
xType = @Tipo
AND
name like ('%' + @Desc + '%')
ORDER BY
NAME
END
No hay comentarios:
Publicar un comentario