@id = 1,2,3,4,5 @name = 'NY, NJ, VA, DC,CA'
I have a temp table called #tmp (id int, name varchar(4)). I want to insert these above comma delimited values in this temp table, so 1 has corresponding value = NY, 2 has NJ etc...so total 5 rows will be inserted. What is the best way to code that in SQL Anywhere?
Request clarification before answering.
CREATE TABLE #tmp_tbl
( qualifier_state_id integer
, event_id integer
, group_id integer
, state_number integer
, qualifier_state_name varchar(255)
)
INSERT INTO #tmp_tbl(qualifier_state_name) VALUES ('SAMLL')
INSERT INTO #tmp_tbl(qualifier_state_name) VALUES ('YELLO')
Thanks but I have qualifier_state_name in my temp table and my qualifier_state_ids are coming from variavle @qualifier_state_ids = '58,61' Where 58= SMALL and 61= Yello
Now I need to update below temp table and make qualifier_state_id =58 for small and 61 for Yello I tried below but not workin
UPDATE #tmp_tbl a
, sa_split_list(@lQualifierStateIds) b
SET a.qualifier_state_id = TRIM(b.row_value)-- this updates both state_ids =61 whichh is wrong.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.