I was wondering if someone can help me out. I am creating a simple script where I want to auto increment a number into a field with the number being lead by 7 0’s.
Example: 00000001
Here is my script: its a small update script
DECLARE @EDI NVARCHAR(55)
SET @EDI=0000000
UPDATE TESTER11111
SET @EDI=EDI=@EDI+1
WHERE ssq='education'
instead of incrementing the numbers as 00000001, 00000002.
its incrementing as 1, 2, 3, etc.
what am I doing wrong? how can i insert those leading 7 0’s?
EDI is the column that I am inserting the increments.
Let the table increment (and just store integers), but there’s no reason I can think of not to go ahead and format on the select statement; a fixed number format is as much data as business logic
EDIT: if you must save the formatted values: