From: Morton Goldberg Date: 2008-01-30T22:12:30+09:00 Subject: Re: newbie file write problem On Jan 29, 2008, at 7:20 PM, Lars Zeb wrote: > def get_sql > puts %Q{IF EXISTS (SELECT * FROM Sic WHERE Code = '#@sic') > BEGIN > UPDATE Sic > SET Descr = '#@descr' > WHERE Code = '#@sic' > END > ELSE > BEGIN > INSERT INTO Sic > SELECT '#@sic', '#@descr', getdate() > END > } > end Your problem has a simple fix -- remove the 'puts'. You want the string returned -- puts writes the string to stdout and returns nil. Regards, Morton