Assign value to SQL variable

Asked

Viewed 543 times

-1

How do I make one select which assigns the value "10" in all of the games column?

Note: Without giving update on the table.

/*minha_tabela*/
codigo        jogos   
---------------------
  1            10
  2            10
  3            10
  4            10
  5            10
  6            10
  • Your question is not clear enough.

2 answers

1

Expensive,

select codigo, 10 as jogos from minha_tabela

Works on SQL Server...

0

If variable use is required, as stated in the title of the topic, here is an approach:

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

--
SELECT codigo, @jogos as jogos
  from minha_tabela;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.