SQL SERVER Insert Addition? -


so seems should easy. had insert:

insert table values ('op','op_detail','op_x') 

and wanted x go 1-100. (knowing there of numbers exist, if insert fails want keep going)

how such thing?

here's faster way

-- techniques jeff moden , itzik ben-gan: ;with e00(n) (select 1 union select 1),       e02(n) (select 1 e00 a, e00 b),       e04(n) (select 1 e02 a, e02 b),       e08(n) (select 1 e04 a, e04 b),    ctetally(n) (select row_number() on (order n) e08) insert yourtable select 'op','op_detail','op_' + cast(n varchar)   ctetally  n <= 100 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -