The following is the problem that I am facing to:<br><br>I am tring to retrieve values from the database using the code below. I am using Sybase SQL Server. The problem is some of the fields in the database for AlarmLow, AlarmHigh, VetoLow and VetoHigh are blank (no values). The datatype has been set to varchar in the tables. Is the code below appropriate for what I am tring to do? I have also tried changing the 0 to '',' '<br>I am running this program on PowerBuilder and I always seem to get this error message:<br>Error converting datatype from varchar to numeric.<br><br>SELECT @SQLStatement = @SQLStatement + 'alarmlow, alarmhigh, vetolow, ' +<br> 'vetohigh, criteria1value) SELECT ' + RTRIM (CONVERT <br> (CHAR, @Id)) + ', "' +<br> RTRIM (CONVERT (CHAR(30), @DocDateValue)) + '", "' + <br> RTRIM (CONVERT (CHAR(30), @SampleDateValue)) + '", ' + <br> RTRIM (CONVERT (CHAR(30), @Reading)) + ', ' + <br> RTRIM (CONVERT (CHAR(30), IsNull (@AlarmLow, 0))) + ', ' + <br> RTRIM (CONVERT (CHAR(30), IsNull (@AlarmHigh, 0))) + ', ' + <br> RTRIM (CONVERT (CHAR(30), IsNull (@VetoLow, 0))) + ', ' + <br> RTRIM (CONVERT (CHAR(30), IsNull (@VetoHigh, 0))) + ', "' + <br> RTRIM (@Criteria1Value) + '"'<br><br>--MyDebug<br>--SELECT SUBSTRING (@SQLStatement, 1, 200)<br>--SELECT SUBSTRING (@SQLStatement, 201, LEN (@SQLStatement))<br><br><br><br><br>