如何使循环插入数字 [英] How Can Make Loop To Insert Number

查看:97
本文介绍了如何使循环插入数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要插入号码4555 +

0001

0002

0003

0004

0005

0006

0007



和结果:

45550001

45550002

45550003

45550004

45550005

45550006

45550007





insert into CodeTbl(num)

values(4555 + 0001, 2,3,4,5,6,7)



和Select语句的结果是:

select * from CodeTbl



45550001

45550002

45550003

45550004

45550005

45550006

45550007



如何使CAN循环去做.v

I Need Insert Number 4555 +
0001
0002
0003
0004
0005
0006
0007

and The Result :
45550001
45550002
45550003
45550004
45550005
45550006
45550007

Like
insert Into CodeTbl (num)
values (4555+0001,2,3,4,5,6,7)

and The Result From Select Statement is :
select * from CodeTbl

45550001
45550002
45550003
45550004
45550005
45550006
45550007

How CAN Make Loop To Do that .v

推荐答案

也许你需要类似



Maybe you need something like

Update CodeTbl set num = "4555"||num;





某些Sql / DB引擎需要'where'子句 - 所以你可以这样做





Some Sql/DB Engines need a 'where' clause - so you could do

Update CodeTbl set num = "4555"||num where num not null;





你没有说出你正在使用的SQL,但这就是一般的想法....



| |在一些SQL中意味着Concat ..我做的另一个假设,因为你没有提到它,'num'实际上是一个字符串,如你的表示所示



you didnt say what SQL you're using but thats the general idea ....

|| in some SQL means Concat ..the other assumption Im making, since you dont mention it, is that 'num' is actually a string as shown in your representation


这篇关于如何使循环插入数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆