Pergunta

I need to remove Special characters from columns which has them from linked server using OpenQuery.

Here is the example, but it's not working

DECLARE @Query VARCHAR(MAX)

SET @Query =
'

      UPDATE OPENQUERY
      (
            LINKEDSERVER, 
            ''SELECT * FROM TABLE WHERE NAME Like ''''' + '%###%' +  '''''''
      )
      SET NAME = REPLACE(NAME, ''###'', '''')

'

EXEC (@Query)
Foi útil?

Solução

Your question does not seem to match the code you're trying to use. Are the columns you're trying to clense of values in a table on a linked sever?

Then maybe this is what your looking for:

UPDATE OPENQUERY (LINKEDSERVER, 'SELECT name FROM Table WHERE name like ''%###%'' ') 
SET name = REPLACE(NAME, '###', '');
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top