SQL: Converting INT to VARCHAR in Sybase

Using Sybase, I face error 257 when trying to change an INT field to text. I used CAST but it fails. Example:

SELECT CAST(num_val AS VARCHAR(15))
FROM sample_data;

Need assistance.

hey, im curious if u tried rough workaround like subquerying before cast-ing? may be u have some env settings kicking error. anyone else seent this happening?

hey, try using convert() instead of cast. it solved my issuse. also check syb version because some older vers behave differntly. good luck!

Based on my experience, error 257 when converting an INT to VARCHAR in Sybase can often be attributed to subtle issues involving either the specific version of Sybase or implicit data conversion settings that are not immediately obvious. I found that rewriting the query to embed the conversion in a subquery often helped isolate the problem. Additionally, verifying the column metadata and ensuring no unexpected constraints exist is critical. It also helped to test the conversion on a standalone query to see if the problem persists. These steps allowed me to narrow down the source of the error.