From: Joshua Moore-O. <jo...@ch...> - 2004-07-20 15:58:48
|
Basically, whenever I insert a text field into a table, it gets a whitespace added to the end.. I am using Sybase 0.36 with freetds Here is a simple python script displaying this behaviour (server names and passwords removed for security) import Sybase sServer='' sUser='' sPassword='' sDbName='' conn = Sybase.connect( sServer, sUser, sPassword, sDbName ) cur = conn.cursor() cur.execute( "CREATE TABLE tblTest( iId int, sIp text );" ) sSql = ( 'INSERT INTO tblTest ( iId, sIp )\n' ' VALUES( 1, @sIp ); \n' ) cur.execute( sSql , { '@sIp' : '12.34.56.87' } ) After this scripts runs, run this command SELECT * FROM tblTest WHERE sIp LIKE '% '; you will see the row come up.. and just as further proof that it's not a weird LIKE operator.. UPDATE tblTest SET sIp = rtrim(CAST( sIp AS varchar )); will have show that it did indeed remove a space from the end as shown by a consecutive SELECT * FROM tblTest WHERE sIp LIKE '% '; Josh. |