Unanswered: Inserting multiple records using a @start and @count with one INSERT (and no loop)
Is there a way to insert multiple records into a database table when you're just given "count" of the number of rows you want? I want to do this in ONE insert statment, so I don't want a solution that loops round doing 100 inserts - that would be too inefficient.
For example, suppose I want to create 100 card records starting it card number '1234000012340000'. Something like this ...
declare @card_start dec(16)
set @card_start = '1234000012340000'
declare @card_count int
set @card_count = 100
Thanks Peso! That was the kind of creative idea I was looking for. Unfortunately 2047 isn't high enough, I probably need to go up to max-integer. But you've got me thinking about using system tables and ROW_NUMBER(). I could just do a left-outer-join with master..spt_values on itself, that will give me a lot higher max. Thanks again!