Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hi, i m using chosen multi select plugin in my project. it is working fine with adding new records in database table. but i m struggling with retrieving the records while i do edit. In my database table multi select values inserting with comma separator(eg: 2,3,4,). help assist me sort this issue #3095

Open
joyalgeorgek123 opened this issue Jun 29, 2020 · 3 comments

Comments

@joyalgeorgek123
Copy link

No description provided.

@joyalgeorgek123 joyalgeorgek123 changed the title Hi, i m using chosen multi select plugin in my project. it is working fine with adding new records in database table. Hi, i m using chosen multi select plugin in my project. it is working fine with adding new records in database table. but i m struggling with retrieving the records while i do edit. In my database table multi select values inserting with comma separator(eg: 2,3,4,). help assist me sort this issue Jun 29, 2020
@joyalgeorgek123
Copy link
Author

Capture
Capture1

@MahammadMoine
Copy link

Here my question is why using for loop. No need to use loop. By default chosen multi select submit in array format accept in array on server and insert in table.
OR using Join method on server code create comma separated value and pass to procedure.
If you are passing comma separated value to your procedure then split there using split method and insert.

INSERT INTO EMPLOYEE_DETAIL
(EMPNAME,ADDRESS)
SELECT *,@address
FROM STRING_SPLIT(@EMPLOYEENAME, @Separator)

https://codingsight.com/several-ways-to-insert-split-delimited-strings-in-a-column/

@jacobocano
Copy link

Use: STRING_SPLIT for SQL SERVER 2016 to 2019, for SQL SERVER 2014 or previous use:

SELECT split.a.value('.', 'VARCHAR(249)') AS Value FROM (SELECT Cast ('' + Replace(@Años, ',', '')+ '' AS XML) AS Data) AS A CROSS apply data.nodes ('/M') AS Split(a)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants