[[REPLACE Keyword/Statement Examples
Example 1 /* This example can be copied to the DBManager SQL window and tested with right click, SQL to Log */ -- [[REPLACE @CD1ABS =E:\RPM\2019SCC\Masters4DataEntry\CD1_DERT_190425a.ABS]] -- [[REPLACE @CD2ABS =E:\RPM\2019SCC\Masters4DataEntry\CD2_DERT_190222a.ABS]] -- .... additional sql script INSERT INTO memory AllTags(NameKey,tagName,tagNameSub,tagRank) SELECT * FROM '@CD1ABS'.Tags T1; -- the @_CD1ABS gets replaced with the defined pathfilename -- .... additional sql script -- [[REPLACE @Q1Sub = LEFT JOIN( SELECT Substring(T12.tagName,13,1) AS CAUCATT FROM memory AllTags T12, memory TaggedPeople P2 WHERE ((P2.NAMEKEY = T12.NAMEKEY) AND (T12.tagName = "2018 Caucus Attendee"))) AS Q1 ON Q4.NAMEKEY = Q1.NAMEKEY -- end Q1Sub ]] -- .... additional sql script to complete processing for CD1 TRUNCATE memory AllTags; -- clear tags from CD1 TRUNCATE memory TaggedPeople; -- clear tagged people from CD1 INSERT INTO memory AllTags(NameKey,tagName,tagNameSub,tagRank) SELECT * FROM '@CD2ABS'.Tags T2; -- the @_CD2ABS gets replaced with the defined pathfilename -- .... additional sql script @Q1Sub -- the @_Q1Sub gets replaced with the sql script in the Replace @_Q1Sub section used above -- .... additional sql script Example 2 --[[REPLACE @myTable ="C:\temp\dertTestData\CD1_DERT_190115a.ABS".People]] --[[REPLACE @LastName = LNAME]] -- The space after the equal(-) sign is part of the ReplaceValue --[[REPLACE @FirstName = "Gomer]] -- The space after the equal(-) sign is part of the ReplaceValue SELECT * FROM @myTable WHERE @LastName = "Pyle" AND FNAME =@FirstName" After all string replacements the following would be executed SELECT * FROM "C:\temp\dertTestData\CD1_DERT_190115a.ABS".People WHERE LNAME = "Pyle" AND FNAME = "Gomer" Example 3 /* Nested REPLACE statements. This example for illustrative purposes only [[REPLACE &Y = World]] &Y must be defined first [[REPLACE $Z =Hello&Y]] */ $Z -- Will read "Hello World" (without the quotes) after processing.