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.

67 lines
3.3 KiB

1 year ago
  1. USE [FastMoneyPro_Remit]
  2. GO
  3. /****** Object: StoredProcedure [dbo].[proc_importLocationAPI] 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. EXEC proc_importLocationAPI
  10. */
  11. CREATE proc [dbo].[proc_importLocationAPI]
  12. @user VARCHAR(10) = NULL
  13. AS
  14. SET NOCOUNT ON
  15. --DECLARE @SPWithParams NVARCHAR(MAX)
  16. --SET @SPWithParams =
  17. -- '
  18. -- Exec ime_plus_01.dbo.spa_SOAP_Domestic_DistrictList '
  19. -- + '''''' + 'kathmandu' + '''''' + ','
  20. -- + '''''' + 'kathmandu' + '''''' + ','
  21. -- + '''''' + 'kathmandu' + '''''' + ','
  22. -- + '''''' + '1234' + '''''' + ','
  23. -- + '''''' + 'c' + ''''''
  24. --PRINT(@SPWithParams)
  25. --EXEC ProcToTable @SPWithParams, '##res'
  26. DECLARE @code VARCHAR(50)
  27. ,@userName VARCHAR(50)
  28. ,@password VARCHAR(50)
  29. EXEC proc_GetAPI @user OUTPUT,@code OUTPUT, @userName OUTPUT, @password OUTPUT
  30. create table ##DistList
  31. (
  32. code varchar(20),
  33. district_code varchar(20),
  34. district_name varchar(300)
  35. )
  36. INSERT INTO ##DistList(code,district_code,district_name)
  37. Exec ime_plus_01.dbo.spa_SOAP_Domestic_DistrictList_V2
  38. @code,@userName,@password,'1234','c'
  39. IF((SELECT TOP 1 code FROM ##DistList) <> 0)
  40. BEGIN
  41. EXEC proc_errorHandler 1, 'Technical Error in importing data', NULL
  42. DROP TABLE ##DistList
  43. RETURN;
  44. END
  45. DELETE FROM api_districtList WHERE ISNULL(fromAPI, 'Y') = 'Y'
  46. INSERT INTO api_districtList(code, districtCode, districtName, fromAPI, createdBy, createdDate)
  47. SELECT code, district_code, UPPER(district_name), 'Y', @user, GETDATE() FROM ##DistList
  48. EXEC proc_errorHandler 0, 'Import Successful', NULL
  49. DROP TABLE ##DistList
  50. GO