DROP PROC AGREGARTODOSLOSDERECHOS_PROC
GO
CREATE PROC AGREGARTODOSLOSDERECHOS_PROC
@USERID UD_USERID
AS
 INSERT INTO SE_ACCESSDETRIGHTS (USERID,
                                   SCREENID,
                                   VIEWRIGHTS,
                                   INSERTRIGHTS,
                                   UPDATERIGHTS,
                                   DELETERIGHTS,
                                   PRINTRIGHTS,
                                   NULLRIGHTS,
                                   CLOSERIGHTS)
SELECT @USERID,SCREENID,1,0,0,0,1,0,0 FROM SE_SCREEN WHERE SCREENID NOT IN (SELECT SCREENID FROM SE_ACCESSDETRIGHTS WHERE USERID=@USERID)

GO

EXEC AGREGARTODOSLOSDERECHOS_PROC 'CANCRED'
