Can I create column values from say '80000001' to '80001000' using Python?
Mij
Posts: 23 Bronze 1
Hi, I'm trying to create a numerical string (nvarchar(8)) for employee ID's and I want to create test data out of range of real data. The simplest would be to start with '80000001' and increment for each row until 1000 rows which would be '80001000'. How can I do this?
Tagged:
Best Answer
-
Jessica R Posts: 1,319 Rose Gold 4Hi @Mij!
I believe you should be able to achieve this with a python script...
Using something like the "numbered labels" example in https://documentation.red-gate.com/sdg3/using-generators/example-python-scripts his seems to give the desired effect:def main(config):
return list(Sequence(config["n_rows"])) # The max number of rows available
def Sequence(max):
for i in range(1, max + 1): # Modify the range start and end points in order to offset the row number
yield "8000{0:0>3}".format(i) # Format the output string here
Hope that helps!
Answers