Monday, August 3, 2015

Quick reference - SQL_FormatStrings()

 "SQL_FormatStrings() function which will double up single quote characters and also surround the string with starting and ending single quotes. This will avoid the issues caused by a single quote in the data terminating a string early". says Developing for GP

Use this when doing passthrough SQL when you need to specify string values.

local text sql;
sql = "SELECT * FROM myTable WHERE Field = " + SQL_FormatStrings("Hello");

That will turn into SELECT * FROM myTable WHERE Field = 'Hello'


No comments:

Post a Comment