You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
5.2 KiB

1 year ago
  1. USE [FastMoneyPro_Remit]
  2. GO
  3. /****** Object: StoredProcedure [dbo].[PROC_UPDATE_METAPHONE] Script Date: 9/27/2019 1:30:14 PM ******/
  4. SET ANSI_NULLS ON
  5. GO
  6. SET QUOTED_IDENTIFIER ON
  7. GO
  8. /*
  9. SELECT TOP 10 rowId,name from blacklist WHERE name <>''
  10. SELECT dbo.FNASplitAndCallDblMetaPhone(1,'asdfdfdf')
  11. select * from BlackListSound
  12. -- SELECT * FROM blacklist
  13. EXEC PROC_UPDATE_METAPHONE
  14. GO
  15. */
  16. CREATE proc [dbo].[PROC_UPDATE_METAPHONE]
  17. AS
  18. BEGIN
  19. SET NOCOUNT ON;
  20. update BLACKLIST set
  21. MP = dbo.FNASplitAndCallDblMetaPhone(name)
  22. where isnull(name,'') <> ''
  23. DECLARE
  24. @I1 int,
  25. @I2 int,
  26. @I3 int,
  27. @I4 int,
  28. @I5 int,@I6 int,@I7 int,@I8 int,@I9 int,@I10 int
  29. UPDATE U
  30. SET
  31. @I1 = CHARINDEX(',', MP + ',')
  32. ,[MP1] = LEFT(MP, @I1-1)
  33. ,@I2 = NullIf(CHARINDEX(',', MP + ',', @I1+1), 0)
  34. ,[MP2] = SUBSTRING(MP, @I1+1, @I2-@I1-1)
  35. ,@I3 = NullIf(CHARINDEX(',', MP + ',', @I2+1), 0)
  36. ,[MP3] = SUBSTRING(MP, @I2+1, @I3-@I2-1)
  37. ,@I4 = NullIf(CHARINDEX(',', MP + ',', @I3+1), 0)
  38. ,[MP4] = SUBSTRING(MP, @I3+1, @I4-@I3-1)
  39. ,@I5 = NullIf(CHARINDEX(',', MP + ',', @I4+1), 0)
  40. ,[MP5] = SUBSTRING(MP, @I4+1, @I5-@I4-1)
  41. ,@I6 = NullIf(CHARINDEX(',', MP + ',', @I5+1), 0)
  42. ,[MP6] = SUBSTRING(MP, @I5+1, @I6-@I5-1)
  43. ,@I7 = NullIf(CHARINDEX(',', MP + ',', @I6+1), 0)
  44. ,[MP7] = SUBSTRING(MP, @I6+1, @I7-@I6-1)
  45. ,@I8 = NullIf(CHARINDEX(',', MP + ',', @I7+1), 0)
  46. ,[MP8] = SUBSTRING(MP, @I7+1, @I8-@I7-1)
  47. ,@I9 = NullIf(CHARINDEX(',', MP + ',', @I8+1), 0)
  48. ,[MP9] = SUBSTRING(MP, @I8+1, @I9-@I8-1)
  49. ,@I10 = NullIf(CHARINDEX(',', MP + ',', @I9+1), 0)
  50. ,[MP10] = SUBSTRING(MP, @I9+1, @I10-@I9-1)
  51. FROM blacklist U
  52. TRUNCATE TABLE BlackListSound
  53. insert into BlackListSound (BlackListId, FN1)
  54. select rowId,MP1 from blacklist where isnull(MP1,'') <>'' UNION ALL
  55. select rowId,MP2 from blacklist where isnull(MP2,'') <>'' UNION ALL
  56. select rowId,MP3 from blacklist where isnull(MP3,'') <>'' UNION ALL
  57. select rowId,MP4 from blacklist where isnull(MP4,'') <>'' UNION ALL
  58. select rowId,MP5 from blacklist where isnull(MP5,'') <>'' UNION ALL
  59. select rowId,MP6 from blacklist where isnull(MP6,'') <>'' UNION ALL
  60. select rowId,MP7 from blacklist where isnull(MP7,'') <>'' UNION ALL
  61. select rowId,MP8 from blacklist where isnull(MP8,'') <>'' UNION ALL
  62. select rowId,MP9 from blacklist where isnull(MP9,'') <>'' UNION ALL
  63. select rowId,MP10 from blacklist where isnull(MP10,'') <>''
  64. END
  65. GO