[solved] :( Re: replace similar rows with a 'parametric' one

From: Ammammata <ammammata_at_tiscalinet.it>
Date: Tue, 4 Jun 2019 09:23:31 +0000 (UTC)
Message-ID: <XnsAA6473E39426Cammammatatiscalineti_at_148.251.67.112>


Il giorno Tue 04 Jun 2019 09:25:38a, *Ammammata* ha inviato su comp.databases.mysql il messaggio
news:XnsAA645FE7417Dammammatatiscalineti_at_148.251.67.112. Vediamo cosa ha scritto:

> can I replace with something

found a sort of solution but not applicable now

On Tue Jun 04 2019 11:22:14 GMT+0200 (Central European Summer Time) At How to pass column name as parameter in select statement SQL Server - Stack Overflow
https://stackoverflow.com/questions/30119198/how-to-pass-column-name-as- parameter-in-select-statement-sql-server

You will need to build up the query to execute dynamically, but you will need to protect against SQL Injection attacks. Fortunately, SQL Server provides the QUOTENAME function for this purpose.

DECLARE _at_columnname varchar(50)
SET _at_columnname = 'MyColumn'

EXEC('SELECT ' + QUOTENAME(_at_columnname) + ' FROM MyTable')

-- 
/-\ /\/\ /\/\ /-\ /\/\ /\/\ /-\ T /-\
-=- -=- -=- -=- -=- -=- -=- -=- - -=-
>>>>>  http://www.bb2002.it :)  <<<<<
........... [ al lavoro ] ...........
Received on Tue Jun 04 2019 - 11:23:31 CEST

Original text of this message