Click here to Skip to main content
15,891,943 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Comments
phil.o 11-Oct-15 5:42am    
You do realize that 45550001 is not 4555 + 0001 but 45550000 + 1, don't you?

1 solution

Maybe you need something like

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


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

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


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
 
Share this answer
 
v2
Comments
Member 11280947 11-Oct-15 5:54am    
i Don't Understand This :
Update CodeTbl set num = "4555"||num where num not null;
Garth J Lancaster 11-Oct-15 7:18am    
what dont you understand ? do you or do you not have any numbers at all in your table ? we can only help you if you provide useful information. What is the table definition ?, what sql database are you using ?
Member 11280947 13-Oct-15 3:02am    
Insert From
155460001
155460002
155460003
155460004
155460005


I Need Loop To Do That

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900