chosen
chosen copied to clipboard
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
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/
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 ('<M>' + Replace(@Años, ',', '</M><M>')+ '</M>' AS XML) AS Data) AS A CROSS apply data.nodes ('/M') AS Split(a)