Assign value in SQL variable

-1
How do I make a select that assigns the value "10" in all of the games column?

NOTE: Do not give update in the table.

/*minha_tabela*/
codigo        jogos   
---------------------
  1            10
  2            10
  3            10
  4            10
  5            10
  6            10
    
asked by anonymous 15.04.2017 / 04:18

2 answers

1

Expensive,

select codigo, 10 as jogos from minha_tabela

It works in SQL Server ...

    
15.04.2017 / 04:48
0

If you need to use a variable, as it appears in the topic title, here is an approach:

-- código #1 (T-SQL)
declare @jogos int;
set @jogos= 10;

--
SELECT codigo, @jogos as jogos
  from minha_tabela;
    
15.04.2017 / 16:22