Click here to Skip to main content
15,902,938 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i want to insert multiple int values selected from dropdown in to a single column seperated by a delimiter(,)
along with this values there are some other rows too in which some other values are inserted

a table has
Booking id which contain values like 1
and roomid which contain values like 1,2,3

how can i do it using sql server insert query
Posted

ritesh2712 wrote:
insert multiple int values selected from dropdown in to a single column

Since the comma separated values are selected from a dropdown, form this value in code behind on server side before sending it for SQL update.

So it would be
SQL
INSERT INTO tableBook 
(BookingId, RoomId)
VALUES
(1,'1,2,3')
 
Share this answer
 
You need to normalize your table.

Create a new table which now has bookingid and roomid -

booking id - roomid
-------------------
1 - 1
1 - 2
1 - 3
2 - 44

and so on...
 
Share this answer
 
v2
Parse the int values from drop down selection @ FE convert them to another string variable and then pass it to BE query... we are doing this but in reverse order....can u tell how you are passing the values to BE?
 
Share this answer
 

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