Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 7129

"A SELECT statement that assigns a value to a variable must not be combined with data-retrieval operations" problem

$
0
0

Hi there

Why simple request like

SELECT  @j=Id, Status from [Employee] where [Id]>100;

cause problem, shown in the subject?

First of all, why I cannot use the "into" reserved word - it is the TSQL standard, isn't it? Why should I use the @a=b notation instead? Is there any chance to abide by a TSQL standard for MS SQL clauses?

To solve the problem, I cannot re-write the clause above like

SELECT  @j=Id, @Status=Status from [Employee] where [Id]>100;

cause I have to declare @Status variable, which I do not need in my logic and which makes my migration from the different Sql server to MS SQL a nightmare.

Any clue?

Thanks.


Viewing all articles
Browse latest Browse all 7129

Trending Articles



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