Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Something wrong with the SQL code in SQL server 2014

$
0
0

Hey there. I have very simple SQL code in SQL server 2014 management studio. Here it is:

DECLARE @a INT, @b INT
SET @a=COUNT(Capital) FROM [dbo].[list_of_countries]
SET @b=@a-1
SELECT @b as Capitals

-------------------------

And when executing, the error appears:

Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'FROM'.

---------------------

Can you tell me what is the problem here?


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>