Support
Quality
Security
License
Reuse
kandi has reviewed OpenIDM and discovered the below as its top functions. This is intended to give you an instant insight into OpenIDM implemented functionality, and help decide if they suit your requirements.
Mirror of https://stash.forgerock.org/projects/OPENIDM/repos/openidm
Insert multiple rows of data with out looping the table data
INSERT INTO ForgeRock1 (productName)
SELECT DISTINCT productName FROM ForgeRock fr
WHERE NOT EXISTS ( SELECT 1 FROM ForgeRock1 fr1 WHERE fr1.productName = fr.productName )
Decode encoded string while transforming in openidm
if (source != null)
{
var base64 = Packages.org.forgerock.util.encode.Base64url
b64tO = new Packages.java.lang.String(base64.decode(source));
logger.info("Decoded: {}", b64tO);
target = b64tO;
}
QUESTION
Insert multiple rows of data with out looping the table data
Asked 2021-Aug-17 at 08:02I have a table where it holds some duplicate entries, I would like to copy over the distinct entries to another table with out looping the data. I need to check if the distinct data exists in other table and insert what ever is missing. Here is the query I am writing, I feel like it can be implement better
CREATE TABLE ForgeRock
([productName] varchar(13));
INSERT INTO ForgeRock
([productName])
VALUES
('OpenIDM'), ('OpenAM'), ('OpenDJ'), ('OpenDJ'),('OpenDJ1');
CREATE TABLE ForgeRock1
([productName] varchar(13));
DECLARE @prodName NVARCHAR(MAX)
SELECT DISTINCT @prodName = STUFF((SELECT ',' + productName
FROM ForgeRock
FOR XML PATH('')) ,1,1,'')
set @prodName = ''''+replace(@prodName,',',''',''')+''''
INSERT INTO ForgeRock1 (productName)
SELECT DISTINCT productName FROM ForgeRock WHERE
productName NOT IN (SELECT productName FROM ForgeRock1
where productName NOT IN (@prodName))
Here is the sample fiddle I tried out http://sqlfiddle.com/#!18/9dbe8f/1/0, is this query efficient or can it be better
ANSWER
Answered 2021-Aug-17 at 08:02This query should do what you want :)
INSERT INTO ForgeRock1 (productName)
SELECT DISTINCT productName FROM ForgeRock fr
WHERE NOT EXISTS ( SELECT 1 FROM ForgeRock1 fr1 WHERE fr1.productName = fr.productName )
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Save this library and start creating your kit
Save this library and start creating your kit