I am new to SQL Server, I am trying to insert a 6 digit string value into a NVARCHAR column. But it stores the data perfectly until the 6 digit string starts with 0.
Ex: 001212 -->stores as 1212
121212 -->stores as 121212
012121 -->stores as 12121
120121 -->stores as 120121
I searched for the solution on stackoverflow but I can get solution for this .
But I have an idea that validate the string length if it is not 6 digit then adding 0 .
if it is correct can someone help me to do it .
If it's a string work with it like it's a string. That is, enclose literal values in single quotes (and add the Nprefix for nvarchars).
INSERT INTO elbat (nmuloc)
VALUES (N'000007');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With