Pessoal O tratamento para inserir registros com campo text em Sybase ficou muito complicado no Centura. Sugiro procuraram no help por Writing IMAGE and TEXT Data to Sybase. V�o encontrar algo como abaixo colado do help do CTD 2.0: To write IMAGE or TEXT data of up to 64K, you may use the INSERT or UPDATE SQL statements, but you must then supply the data as a literal or a constant. You can write IMAGE or TEXT data of any size using the function SybWriteText; assign the data to a variable and pass that variable as an argument to SybWriteText. Note: If you attempt to execute an INSERT or UPDATE statement using bind variables on an IMAGE or TEXT column, the current transaction will be rolled back and you will be presented with the error message returned by the database server. This is because Sybase does not support dynamic parameters for TEXT and IMAGE data. To retrieve IMAGE or TEXT data that you do not intend to update: 1. Define a normal SQL cursor to fetch the data. (To scroll backwards and forwards in the result set, turn on result set mode.) 2. To retrieve IMAGE or TEXT data that you wish to update: 3. Get a SQL handle (for example, hSql1). 4. Turn off result set mode (specifying the handle hSql1). To preserve the cursor context, turn on CCP before turning off result set mode. 5. Execute a SELECTFOR LONG UPDATE statement, specifying hSql1. (The FOR LONG UPDATE clause is an extension to SQL that Centura SQLWindows uses for Sybase System 10 and System 11 only.) 6. Position to the row you wish to update. 7. Get another SQL handle (for example, hSql2). 8. Call SybWriteText (using hSql2) to update the row. To insert IMAGE or TEXT data: 1. Get a SQL handle (for example, hSql1). 2. Insert a dummy value (such as a space) into the target column by preparing and executing the SQL INSERT statement and specifying the handle hSql1. 3. Commit the insert operation (if autocommit is off) specifying the handle hSql1. 4. Turn off result set mode (specifying the handle hSql1). To preserve the cursor context, turn on CCP before turning off result set mode. 5. Execute a SELECTFOR LONG UPDATE statement, specifying hSql1. (The FOR LONG UPDATE clause is an extension to SQL that Centura SQLWindows uses for Sybase System 10 and System 11 only.) 6. Position to the desired row. 7. Get another SQL handle (for example, hSql2). 8. Call SybWriteText (using hSql2) to update the row. To delete IMAGE or TEXT data: 1. Turn on result set mode. 2. Execute a SELECTFOR UPDATE statement. 3. Position to the desired row. 4. Execute the DELETE statement. When calling SybWriteText, you can choose whether or not to log the update of the IMAGE or TEXT column by setting the bLogging argument to this function appropriately � if bLogging is FALSE, the database server will not log the update. Note that you must enable the sp_dboption option (select into/bulkcopy) on the database server to perform operations without logging. Important: You should ignore the information about hex strings and updating IMAGE or TEXT data with the SELECT...FOR LONG UPDATE statement in that book. O que me espanta � que isso tudo � necess�rio mesmo sendo o acesso ao BD feito via router da linguagem para o Sybase ! Ser� que alguma coisa n�o podia ser resolvida diretamente por ele ? Paci�ncia e boa sorte a todos, Marcelo Filipe Rodrigues Urbano [EMAIL PROTECTED] ----- Original Message ----- From: Joel Ritter Ferreira To: [EMAIL PROTECTED] Sent: Monday, August 19, 2002 5:14 PM Subject: Re: [sqlwin] Campo text em Sybase
Tive um problema similar, no meu caso tive que fazer duas coisas: 1) Nao usar bind variables, ou seja concatenar o conteudo dentro do value. 2) Por conseq��ncia do citado acima tive que criar uma fun��o para fazer essa concatena��o que procurava por aspas simples e duplas e alternava os delimitadores da string a ser inserida, de forma a n�o perder o conte�do original. ----- Original Message ----- From: Quadrante To: '[EMAIL PROTECTED]' Sent: Monday, August 19, 2002 1:41 PM Subject: [sqlwin] Campo text em Sybase Prezados Centuri�es Na inser��o em uma tabela com campo do tipo text, e a variavel centura do tipo long string, o banco sybase est� retornando um erro. Algu�m j� passou por isso? existe alguma fun��o (do banco ou do centura) que deve ser chamada antes do insert? Desde j� agrade�o a ajuda. Frederico Rodrigues Pereira Analista de Sistemas Desenvolvedor Centura --- Mensagem enviada via imp.cmg.com.br --- Bignet CMG Navegando com voce ! SITE..: http://www.cmg.com.br EMAIL.: [EMAIL PROTECTED] ============================================== Lista de Centura SQLWindows Administrador : [EMAIL PROTECTED] [ http://www.centuraexplorer.com ] Para sair desta lista mande mensagem para: [EMAIL PROTECTED] sem nada no Subject e com o comando a seguir no corpo da msg: "unsubscribe sqlwin" (sem as aspas) ==============================================
