replace ou substring em coluna dado tipo text | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

replace ou substring em coluna dado tipo text

Estou tentando utilizar os comandos replace ou substring em campo tipo text, porém ocorre o erro (Argument data type text is invalid for argument 1 of replace function.) alguma idéia do que ocorre ? Obrigado ___________________________________________________________________________________ Using Replace command in TEXT datatype column. I am trying to replace a preset charcter string with ‘formfeed+linefeed’ in a TEXT field. This ata was loaded via SQL and lost it’s formatting, so I have decided to try to reinsert the carriage returns by replacing a character string that will be inserted into the SQL in place of the carriage returns. select replace(ldtext, ‘"’, ”) from longdescription where ldkey in (select ldkey from equipment where eqnum = ‘EC-BFP-004’) Error: Microsoft SQL Server:8116[Microsoft][ODBC SQL Server Driver][SQL Server]Argument data type text is invalid for argument 1 of replace function.Microsoft SQL Server:8180[Microsoft][ODBC SQL Serv Any ideas? Thanks.
_________________________________________________________________________________ ("esta assim o campo é preciso retirar as aspas")
substring(substring(Coluna, 2, len(Coluna)), 1, len(Coluna)-2)
(new concept of bank)
(ad free)
I’ve move to General DBA Questions because English part has more information.
Luis Martin
Moderator All postings are provided “AS IS” with no warranties for accuracy.
Thanks Luis Unfortunately, you cannot use the REPLACE function on a column with a TEXT datatype. Here’s an article that describes how to do what you want on a TEXT column for information Satya SKJ
This posting is provided “AS IS” with no rights for the sake of knowledge sharing.
You don’t need a cursor for this anyway. Google on this and you’ll find better examples without a cursor. –Frank

Marcelo Colla Re: como utilizar replace em campo tipo text ?
Enviado em: 10 mai 2005 10:11
outra ideia
drop table exemplo
Create Table Exemplo (Campo text)
Insert into Exemplo (Campo) Values (‘Tirar um acento (á) por exemplo’) DECLARE @Retorno binary(16)
Declare @Posicao Int
Select @Posicao = PATINDEX(‘%á%’, campo) -1 From exemplo
SELECT @Retorno = TEXTPTR(Campo) FROM exemplo
UPDATETEXT exemplo.Campo @Retorno @Posicao 1 ‘a’ — altera na posicao 10
Select * From Exemplo Abs,.
(ad free)