Advertisement
jotaced

query crear permiso 933 en todos los perfiles

Jul 4th, 2013
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.56 KB | None | 0 0
  1. --drop table #perfil
  2.  
  3. SELECT IDENTITY(INT)AS id, per_codigo
  4. INTO #perfil
  5. FROM PERFIL
  6.  
  7. --select * from #perfil
  8.  
  9. DECLARE @RowCount INT
  10. SET @RowCount = (SELECT COUNT(per_codigo) FROM #perfil)
  11.  
  12. DECLARE @I INT
  13. SET @I = 1
  14.  
  15. WHILE (@I <= @RowCount)
  16. BEGIN
  17.          
  18.         DECLARE @per_codigo VARCHAR(20)    
  19.        
  20.         SELECT @per_codigo = per_codigo FROM #perfil WHERE id = @I
  21.  
  22.         INSERT INTO PERMISO(PER_CODIGO, IPE_CODIGO, PRM_ABRE, PRM_GRABA, PRM_ELIMINA, PRM_AUTORIZA)
  23.         VALUES(@per_codigo, 933, 0, 0, 0, 1)
  24.    
  25.         SET @I = @I  + 1
  26. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement