Question

In: Computer Science

I need to show this using SQL: Credit card numbers should include asterisks in place of...

I need to show this using SQL: Credit card numbers should include asterisks in place of all digits preceding the last four digits, which will be left visible, regardless of credit card length

Solutions

Expert Solution

As you have not shared your tabel schema here is my attempt to create one and take some action.

BEGIN TRANSACTION;

drop table card;
create table card(number varcar, name varchar);
insert into card (number, name) values ('12345678901234', 'abc') ;
insert into card (number, name) values ('12346678908907', 'pqr');
insert into card (number, name) values ('11111111111934', 'xyz');
COMMIT;

CREATE FUNCTION [dbo].[hideCardNumber](@InputString varchar(card))
RETURNS VARCHAR(card)
AS
BEGIN
declare @len int
,@Counter int
,@OneChar char(1)
set @Counter = 1
set @len = LEN(@card);
while (1 = 1)
begin
set @OneChar = SUBSTRING(@InputString, @Counter, 1)
set @InputString = REPLACE(@InputString, @OneChar, '*')
set @Counter = @Counter + 1

if (
@Counter > @len - 4
)
break;
end

return @InputString
END


select * from card;

select dbo.hideCardNumber(number) as num from card;


Related Solutions

I need java code for this ..thx Question 2 Credit card numbers are not completely random...
I need java code for this ..thx Question 2 Credit card numbers are not completely random sequences; they follow certain rules depending on the card issuer. A MasterCard number must meet these criteria: • Begin with 51, 52, 53, 54, 55, or something in the range 222100-272099 • 16 digits in length • Satisfy the Luhn formula, created by IBM scientist Hans Peter Luhn in the 1950s Here’s how the Luhn formula works: Double every other digit going backwards, starting...
I am working on an assignment using SQL Server Management and I need to print an...
I am working on an assignment using SQL Server Management and I need to print an ERD to a single page as a PDF file. I am not sure how to do this especially because the diagram is rather large... I am using SQL Server Management Studio I have created an Entity relationship diagram for AdventureWorks that includes all product tables. There are many tables.How do I print it to a single page?
please give complete code in python using def function thank you! Validate Credit Card Numbers Credit...
please give complete code in python using def function thank you! Validate Credit Card Numbers Credit card numbers can be quickly validated by the Luhn checksum algorithm. Start at the rightmost digit save one (the last being the checksum digit). Moving left, double the value of every second digit. If the doubled value is greater than nine, then subtract 9 from the doubled value to renormalize within the range 0–9. Sum all the digits including the checksum digit. If this...
Credit Cards Credit card numbers follow patterns. Cards must have 13 - 16 digits (inclusive) Card...
Credit Cards Credit card numbers follow patterns. Cards must have 13 - 16 digits (inclusive) Card numbers must start with the number(s): 4 for Visa cards 5 for MasterCard cards 37 for American Express cards 6 for Discover cards Given that a number has satisfied the above criteria A and B the following steps are taken to validate the number: Double every second digit from right to left.  If doubling the digit results in a two-digit number, add the two digits...
I need step by step to know where is my mistake ? Account Name: Credit Card...
I need step by step to know where is my mistake ? Account Name: Credit Card – Visa $0 November 30, 2021 Checking - Raincross Business Bank 4673 $13,000 November 30, 2021 Savings - Raincross Business Bank$5,000 November 30, 2021 Display your trial balance report for 12/01/2021 Wednesday, December 1, 2021 •Received cash from Dan Greany for Hand Wash with Interior and Electronic Odor Elimination services, using Sales Receipt number 21-102. (Remember to deposit to Undeposited Funds.) •Received check number...
For the best terms on a loan or credit card, you need a credit score above...
For the best terms on a loan or credit card, you need a credit score above 700. To achieve this, start establishing credit now. Pay all of your bills on time. In addition, use only one-third of your available credit limit and pay off your revolving balance(s) each month. R. J. Johnson has excellent credit. She wants to purchase a piece of equipment for her business and was offered 7% for 72 months for the $49,000 unit. What is her...
I NEED THIS CODE FOR C++ USING MONITORS PLEASE #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include...
I NEED THIS CODE FOR C++ USING MONITORS PLEASE #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <pthread.h> #define THREADS 10 // Number of Thread //bridge declared with array of character and integer value void Bridge(char array[], int value); // Global Variable int North = 1; //For North Number int South = 1; //For South Number pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER; // Setting Up MUTEX for lock //Thread for North farmer void NorthFarmer(){ pthread_mutex_lock(&mutex1); char array[5] = "North"; // North printf("%s Tunbridge...
I need a brief summary/your thoughts on the article. The long-standing narrative of credit card security...
I need a brief summary/your thoughts on the article. The long-standing narrative of credit card security is that offline transactions are more secure than online. Today, this narrative is more fiction than fact. Online transactions are more popular and secure than ever before, thanks to advancements in digital payments technology, demographic shifts, and the evolving cyber-security landscape. At the same time, offline payments seem more insecure than ever before. The outbreak of high-profile security breaches at major retailers has shed...
I just applied for a credit card from Lowe’s (“hardware stores – only things you need,...
I just applied for a credit card from Lowe’s (“hardware stores – only things you need, nothing you want.”) and the APR is 24.99% with monthly payments (I am not kidding). What is the EAR on this credit card? If you have a balance of $7,500 and make minimum payments of $350 a month, how many months until this card is paid off? Bond Gold has a coupon rate of 4.3 percent. Bond Griff has a coupon rate of 14.3...
Part I – Consumer Credit Gregg is planning to apply for a new credit card and...
Part I – Consumer Credit Gregg is planning to apply for a new credit card and is considering the following three choices. He is also planning to buy a $500 big screen television and plans to pay for this over a two-year period by making equal monthly. Credit Card Annual Interest Rate Annual Fee MBNA True Line Master Card 8.99% $39 Desjardins Classic Visa 12.90% $30 American Express Essential Credit Card 12.99% $0 Question 71 What would be his monthly...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT