Escaping Single Quotes in Sybase T-SQL

Most individuals having database experience with MySQL will find shortly after using Sybase DBMS that the backslash character does not escape characters. Instead in Sybase T-SQL the single quote itself acts as the escape character. Below is a sample UPDATE statement showing the difference in escaping the single quote character in MySQL and Sybase.

MySQL

UPDATE COMPANY SET NAME = 'Joseph's Shoes' WHERE ID = 3

Sybase

UPDATE COMPANY SET NAME = 'Joseph''s Shoes' WHERE ID = 3
// T-SQL // Tips & Tricks //

Comments & Questions

Add Your Comment