Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
p0rt21
Starting Member
3 Posts |
Posted - 2003-05-10 : 07:26:08
|
| HeyBit of a noob questionhow can i insert an array into its own rowinsert into sold (price,product_id) values ('3, 5','2701, 2763')Cheersp0rt21 |
|
|
harshal_in
Aged Yak Warrior
633 Posts |
Posted - 2003-05-10 : 08:43:11
|
quote: HeyBit of a noob questionhow can i insert an array into its own rowinsert into sold (price,product_id) values ('3, 5','2701, 2763')Cheersp0rt21 u can use the function csvtoint i guess :http://www.sqlteam.com/item.asp?ItemID=11499
Expect the UnExpected |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2003-05-10 : 10:24:41
|
| the way to insert multiple rows of values into a table is:insert into sold (price, product_id)SELECT price, product_idfromSomeTableif the data is already in a table. this is the alternate format for INSERT INTO, rather than using VALUES. YOu can select from any table into another, as long as the field types and all that match up.you can create your own "fake table" of values like this:select 3,5 unionselect 2701, 2763 unionselect 4,6 unionselect 5,7and so onThus, in your specific example, you could do:insert into sold (price,product_id)select 3, 5 unionselect 2701, 2763I hope this helps a little.- Jeff |
 |
|
|
p0rt21
Starting Member
3 Posts |
Posted - 2003-05-10 : 19:18:54
|
| thanks for thatbutthe array is coming from a hiddenfield in a formim using asp |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
|
|
p0rt21
Starting Member
3 Posts |
Posted - 2003-05-10 : 21:12:42
|
| thanks for that but i don't really understand it |
 |
|
|
ValterBorges
Master Smack Fu Yak Hacker
1429 Posts |
Posted - 2003-05-11 : 01:56:15
|
| You can tell us what you do know and we'll recommend some reading materials. |
 |
|
|
|
|
|
|
|