Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. set ANSI_NULLS ON
  2. set QUOTED_IDENTIFIER ON
  3. go
  4.  
  5. ALTER Procedure [dbo].[GNN_TecnicosPorUnidadGet]
  6. (
  7. @idUnidad int
  8. )
  9.  
  10. as
  11.  
  12. declare @ret varchar(4000)
  13. set @ret = ''
  14. declare cur cursor
  15.  
  16. for
  17.  
  18. select t.NombreTecnico
  19. from GNN_TecnicosPorComercial t
  20.  
  21. inner join vw_aspnet_MembershipUsers m
  22. On t.NombreTecnico = m.UserName
  23. And IsLockedOut = 0
  24.  
  25. inner join GNN_ComercialPorUnidad c
  26. on t.NombreComercial = c.NombreComercial
  27. and c.IdUnidad = @idUnidad
  28.  
  29. declare @tecnico varchar(100)
  30. open cur
  31.  
  32. fetch next from cur into @tecnico
  33. while (@@fetch_status != -1)
  34. begin
  35. set @ret = @ret + '{' + @tecnico + '}'
  36. fetch next from cur into @tecnico
  37. end
  38. close cur
  39. deallocate cur
  40.  
  41. select @ret as Tecnicos
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement