Guest User

Untitled

a guest
Jun 23rd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. SELECT TOP 14 ContactAssociate
  2. FROM tb_Contact
  3. WHERE tb_Contact.ContactAssociate = 'David'
  4. ORDER BY NEWID()
  5.  
  6. UPDATE tb_Contact
  7. SET ContactAssociate = 'Peter'
  8. IN
  9. (
  10. SELECT TOP 14 ContactAssociate
  11. FROM tb_Contact
  12. WHERE tb_Contact.ContactAssociate = 'David'
  13. ORDER BY NEWID()
  14. )
  15.  
  16. UPDATE tb_Contact
  17. SET ContactAssociate = 'Peter'
  18. where PK_Of_tb_Contact
  19. IN
  20. (
  21. SELECT TOP 14 PK_Of_tb_Contact
  22. FROM tb_Contact
  23. WHERE tb_Contact.ContactAssociate = 'David'
  24. ORDER BY NEWID()
  25. )
  26.  
  27. UPDATE c
  28. SET ContactAssociate = 'Peter'
  29. FROM tb_Contact c
  30. INNER JOIN (
  31. SELECT TOP 14 ContactAssociate FROM tb_Contact
  32. WHERE tb_Contact.ContactAssociate = 'David'
  33. ) q ON c.ContactAssociate = q.ContactAssociate
  34.  
  35. SELECT c.*
  36. FROM tb_Contact c
  37. INNER JOIN (
  38. SELECT TOP 14 ContactAssociate FROM tb_Contact
  39. WHERE tb_Contact.ContactAssociate = 'David'
  40. ) q ON c.ContactAssociate = q.ContactAssociate
  41.  
  42. DECLARE @sample int
  43. SET @sample = 7
  44.  
  45. UPDATE tb_Contact
  46. SET ContactAssociate = 'Peter'
  47. where PK_Of_tb_Contact
  48. IN
  49. (
  50. SELECT TOP (@sample) PERCENT PK_Of_tb_Contact
  51. FROM tb_Contact
  52. WHERE tb_Contact.ContactAssociate = 'David'
  53. ORDER BY NEWID()
  54. )
Add Comment
Please, Sign In to add comment