Scribe has the ability to insert SQL queries against a source or target (which does not have to be a database for Scribe). This works great when searching against distinct values.
However, what if you need to format a source field to strip out and prefix text, then match it up to a larger field? In SQL you can declare a variable and perform a LIKE statement.
Plugging that statement into Scribe will cause it to fail. Here is the workaround.
Format the source variable, and save it as a calculated variable to call later.
RIGHT( S1, LEN(S1)-SEARCH(" ",S1 ) ) = cvTrim
Then call your query.
SQLQUERY( cv_Trim, "T", "SELECT [TableField] FROM [Database].[dbo].[Table] WHERE [TableField] LIKE '%' + '%s' + '%' " )
%s references the source field.
However, what if you need to format a source field to strip out and prefix text, then match it up to a larger field? In SQL you can declare a variable and perform a LIKE statement.
Plugging that statement into Scribe will cause it to fail. Here is the workaround.
Format the source variable, and save it as a calculated variable to call later.
RIGHT( S1, LEN(S1)-SEARCH(" ",S1 ) ) = cvTrim
Then call your query.
SQLQUERY( cv_Trim, "T", "SELECT [TableField] FROM [Database].[dbo].[Table] WHERE [TableField] LIKE '%' + '%s' + '%' " )
%s references the source field.
Comments
Post a Comment