N
nicholas
I have this in my stored procedure:
SET @CatInsert = 'INSERT INTO tbl_shopscats (shopID, categoryID) SELECT ' +
CONVERT(varchar,@shopID) + ', categoryID From tbl_categories Where
categoryID IN (' + @categoryID + ')'
@categoryID is a string of ID's separated by comma's. ex: "1,25,78"
So if @shopID = 63
We should have these records inserted:
record1: shopID= 63 and categoryID=1
record2: shopID= 63 and categoryID=25
record3: shopID= 63 and categoryID=78
The problem is that it only insert when the categoryID is "1".
The second problem is that it also inserts "1" if the ID is for ex. "124"
If there is no "1" in the string, nothing is inserted. ex: when @categoryID
= "25,78"
Any ideas ?
Thx,
Nic
SET @CatInsert = 'INSERT INTO tbl_shopscats (shopID, categoryID) SELECT ' +
CONVERT(varchar,@shopID) + ', categoryID From tbl_categories Where
categoryID IN (' + @categoryID + ')'
@categoryID is a string of ID's separated by comma's. ex: "1,25,78"
So if @shopID = 63
We should have these records inserted:
record1: shopID= 63 and categoryID=1
record2: shopID= 63 and categoryID=25
record3: shopID= 63 and categoryID=78
The problem is that it only insert when the categoryID is "1".
The second problem is that it also inserts "1" if the ID is for ex. "124"
If there is no "1" in the string, nothing is inserted. ex: when @categoryID
= "25,78"
Any ideas ?
Thx,
Nic