开发者

Insert Comma Separated Values to SQL

开发者 https://www.devze.com 2023-03-18 08:42 出处:网络
I would like to take a list that I have in a text file, of values 开发者_Python百科which are separated by commas:

I would like to take a list that I have in a text file, of values 开发者_Python百科which are separated by commas:

Example - 1,2,3,4,5,6,7,8,9,0

then put the values in a database table(I'm going to use this table for auto-complete with jQuery).

I would have done an array for the auto-complete but I have something like 1000 values so I think its better to pull from SQL(am i right?)

Try to explain it to me slowly cause I'm a novice and this is so confusing :)


If those are 1000 constant values (like countries), put them in array.
If they are fairly dynamic, put them in a table
Assuming the table is called T1 and has one field F1, you need to transform the string 1,2,3,4,5,6,7,8....N to

INSERT INTO T1
VALUES (1),(2),(3),(4),(5),(6),(7),(8)......(N);
0

精彩评论

暂无评论...
验证码 换一张
取 消