Problems section of ADS provides insights into the query and prompts us with the resolutions in many cases.
The below screenshot is a comparison between ADS and SSMS and it is clearly visible, while you write the code itself, ADS “Problem” section provided information that there is a KEY word missing in the 5th row and 9th column.
ANY is a SQL operator that used to compare a scalar value with a set of single column resultset from a subquery. If any one of the value in the resultset is satifying the operator condition to the scalar value, then it return TRUE, else FALSE.
--Table Creation
create Table EmpDetails
(
EmployeeID int,
EmployeeName Varchar(200),
Grade Int
)
CREATE tABLE EmpYears
(
EmployeeID int,
YearOfExp Int
)
--Data Population
Insert into EmpDetails Values
(1,'Employee1',3),(2,'Employee1',4),(3,'Employee1',5),
(4,'Employee1',6),(5,'Employee1',7),(6,'Employee1',8),
(7,'Employee1',9)
Insert into EmpYears Values
(1,3),(2,5),(3,7),(4,10),
(5,15),(6,20),(7,25)
--Get the employees with experiences more than 10 years
Select * From EmpDetails
where EmployeeID = ANY(Select EmployeeID From EmpYears where YearOfExp>10)
Drop Table EmpDetails, EmpYears
SOME operator is also working similar to ANY, the below returns same output as ANY.
--Get the employees with experiences more than 10 years
Select * From EmpDetails
where EmployeeID = SOME(Select EmployeeID From EmpYears where YearOfExp>10)
ALL operator in SQL Server returns TRUE if *all* the resultset from subquery is true to the operator condition to the scalar value.
If you enjoyed this blog post, feel free to share it with your friends!
Recently one of my colleague reached out to me with an error message as : “Server is not configured for RPC”
This a typical issue with Linked Server. When we configure a linked server, we need to set up the right values for RPC & RPC Out . We can see these values in SSMS -> Right click on Linked Server -> Properties -> Server Options as in the below screen shot.
RPC / RPC Out
RPC stands for Remote Procedure Call and allows you to run stored procedures on the Linked Server. RPC enables Remote Procedure Calls from the specified server and RPC OUT enables Remote Procedure Calls to the specified server.
Hope this helps; If you enjoyed this blog post, feel free to share it with your friends!
Advertisements
This site discusses and shares thoughts and experiences in SQL Server.