AnsweredAssumed Answered

ExecuteSQL for sybase query returns ?

Question asked by yodavish on Aug 16, 2018
Latest reply on Aug 20, 2018 by monkeybreadsoftware

Hello FM Community,

 

I'm trying to create a script that loops through all records, set the id to a variable, use executeSQL to perform the sequel query that I know runs on the Sybase central.

 

From what I've read, FM has its own set of rules for queries and I have to escape tables and columns. The original query I have concatenates the data that I need, however, I'm not sure I can add it to executeSQL until I understand it better. Instead, I've tried to simplify the query and just to get to work but get a "?" as the return value. Below is the simple executeSQL.

 

Eventually I want it to run this qry and replace the 'pro0000023' with a variable:

 

SELECT icd_id, specimen_id

INTO #table_temp_icds

FROM c_spec_icd

WHERE specimen_id in ('pro0000023')

 

DECLARE @data VARCHAR(100)

DECLARE @specimen_id VARCHAR(100)

 

UPDATE #table_temp_icds

SET @data = @data + icd_id + ', ',

@specimen_id = specimen_id

 

SELECT @specimen_id, substring(@data,1, len(@data)-2 ) as icd

DROP TABLE #table_temp_icds

 

any help on this would be great!

Outcomes