I have a table in SQL with a column called Credit Card Code
Data eg
CCARD-000093
CCARD-000094
CCARD-000095
CCARD-000096
CCARD-000097
CCARD-000098
CCARD-000099
CCARD-000100
CCARD-000101
When inserting data into this table, how can I get the next value in the sequence?
This is what I have so far
SELECT 'CCARD-' +
(SELECT CAST(MAX(CAST(SUBSTRING(ccc.CreditCardCode,7, 6) as INT)) AS
NVARCHAR(MAX)) FROM CustomerCreditCard ccc)
This gives CCARD-101
How can I get this to return CCARD-000101 ???
next value forreturns.NEXT VALUE FORcorrect, so I couldn't get it to return a value.