Hi
How do i write multiple values in a single column, using INSERT INTO
I have a listbox and i want all the selected values from that listbox inserted into a table column
INSERT INTO Orders(OrderID, Items) VALUES ____?????________
Do i need to run the above statement in a loop?
Thanks
qi
3 13843 - INSERT INTO Orders(OrderID, Items) VALUES ____+________
If you need to have all the selected from your listbox in different rows, yes you need to issue multiple insert statements.
--- CK
As far as I understand, the problem is something like this. For Order Id 1, there can be 3 Items(say Item1,Item2,Item3)
For Order Id 2, there can be 5 Items(say Item 1.. Item5, all are comma seperated).
Next you want to insert the values into your database table
So the output will be like
TblOrders OrderID Items
---------- --------
1 Item1,Item2,Item3
2 Item1,Item2,Item3,Item4,Item5
If that is supposed to be the case, handle all the list box items from your Frontend applications all at a time.
I mean to say before passing to the SQL QUERY, you should send the values as, 1 for OrderId filed while Item1,Item2,Item3 for Item field.
So in that case the SQL STATEMENT will be - INSERT INTO Orders(OrderID, Items) VALUES (1,' Item1,Item2,Item3');
You don't have to write any loop in the STORED PROC . Handle from your Frontend application.
Hope this helps.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Jack |
last post by:
I have a text file of data in a file (add2db.txt) where the entries are
already entered on separate lines in the following form:
INSERT INTO `reviews` VALUES("", "Tony's", "Lunch", "Great...
|
by: RotterdamStudents |
last post by:
Hello there,
i have a strange problem. I can't get php to insert multiple rows at once in
a MySQL database. I use the
$sql = "INSERT INTO database (a,b,c,d,e) VALUES ('$a', '$b' ,'$c', '$d',...
|
by: Cliff |
last post by:
I'm trying to do multiple insert statements. The table looks like
this:
CREATE TABLE $table (CNTY_CNTRY_CD char(3),ST char(2),
CNTY_CNTRY_DESCR varchar(50),CNTY_CNTRY_IND char(1),...
|
by: hartley_aaron |
last post by:
Hi,
I have an application running on a wireless device and being wireless I
want it to use bandwidth as efficiently as possible. Therefore, I want
the SQL statement that it uploads to the SQL...
|
by: Elroyskimms |
last post by:
I have a table using an identity column as its Primary Key and two
columns (table reduced for simplicity) EmployeeNumber and ArrivalTime.
CREATE TABLE (
IDENTITY (1, 1) NOT NULL ,
(10)...
|
by: Florence HENRY |
last post by:
Hello,
well, almost everything is in the subject !
I have to fill 2 tables (more complicated than in the example !):
CREATE TABLE A (
id serial primary key,
foo text);
|
by: Geoffrey KRETZ |
last post by:
Hello,
I'm wondering if the following behaviour is the correct one for
PostGreSQL (7.4 on UNIX).
I've a table temp_tab with 5 fields (f1,f2,f3,...),and I'm a launching
the following request :...
|
by: rn5a |
last post by:
During registration, users are supposed to enter the following
details: First Name, Last Name, EMail, UserName, Password, Confirm
Password, Address, City, State, Country, Zip & Phone Number. I am...
|
by: deejayquai |
last post by:
Hi
I'm attempting to insert multiple records from one table into another
based on rows selected in a multiple list box. This all seems to be
working OK until I get to a field where the value is...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |