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?
Comments
2 comments
-
Hi 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! -
Once I got the script syntax and indenting right and changed to 0>4, it worked the way we needed. Thank you. I just need to understand Python a little more.
Add comment
Please sign in to leave a comment.