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.

73 lines
3.6 KiB

1 year ago
  1. USE [FastMoneyPro_Remit]
  2. GO
  3. /****** Object: StoredProcedure [dbo].[proc_pickCustomer] Script Date: 9/27/2019 1:30:14 PM ******/
  4. SET ANSI_NULLS ON
  5. GO
  6. SET QUOTED_IDENTIFIER ON
  7. GO
  8. --DROP PROC proc_pickCustomer
  9. --GO
  10. /*
  11. proc_pickCustomer @customerType = 's', @name = 'Raj'
  12. */
  13. CREATE proc [dbo].[proc_pickCustomer]
  14. @customerType CHAR(1)
  15. ,@membershipId INT = NULL
  16. ,@name VARCHAR(50) = NULL
  17. ,@address VARCHAR(50) = NULL
  18. ,@mobile VARCHAR(50) = NULL
  19. ,@email VARCHAR(50) = NULL
  20. ,@user VARCHAR(30) = NULL
  21. AS
  22. DECLARE @senderList TABLE(
  23. rowId INT IDENTITY(1, 1)
  24. ,membershipId INT
  25. ,name VARCHAR(50)
  26. ,address VARCHAR(50)
  27. ,mobile VARCHAR(50)
  28. ,email VARCHAR(50)
  29. ,customerType CHAR(1)
  30. )
  31. INSERT @senderList
  32. SELECT '101', 'Bijaya Sahi', 'Kathmandu', '9876543210', 'bijay@swifttech.com.np', 's'
  33. UNION ALL
  34. SELECT '102', 'Binay Rai', 'Kathmandu', '1234567890', 'binay@swifttech.com.np', 's'
  35. UNION ALL
  36. SELECT '103', 'Dipesh Shrestha', 'Khadbari', '4563219870', 'dipesh@swifttech.com.np', 's'
  37. UNION ALL
  38. SELECT '104', 'Pralhad Sedai', 'Bharatpur', '9876543210', 'bijay@swifttech.com.np', 's'
  39. UNION ALL
  40. SELECT '105', 'Rajnikanta', 'Banglure', '3345333322', 'gmail@rajnikant.com.np', 's'
  41. UNION ALL
  42. SELECT '106', 'Rajesh Dai', 'Kathmandu', '77777777777', 'rajesh@swifttech.com.np', 's'
  43. INSERT @senderList
  44. SELECT
  45. membershipId
  46. ,name + ' - Receiver'
  47. ,address
  48. ,mobile
  49. ,email
  50. ,'r'
  51. FROM @senderList
  52. SELECT * INTO tCust FROM @senderList
  53. --WHERE customerType = @customerType
  54. -- AND membershiptId = ISNULL(@membershipId, membershipId)
  55. -- AND name LIKE '%' + ISNULL(@name, name) + '%'
  56. -- AND address LIKE '%' + ISNULL(@address, address) + '%'
  57. -- AND mobile LIKE '%' + ISNULL(@mobile, mobile) + '%'
  58. -- AND email LIKE '%' + ISNULL(@email, email) + '%'
  59. GO