in reply to Calling SQL with embedded quotes

If you were using the DBI module to access the database, you could take advantage of the quote method, which takes care of database-specific quoting automagically.
$test = $dbh->quote($test);
I have never done any sybase work, but the syntax of your delete statement looks incorrect. Maybe that is what is causing the problem?