Geeks With Blogs
faizan ahmad Usually the things which were not a straight Google
"Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression"

As the error message suggests , this normally occurs when you are assigning a T-SQL variable a value within sql query and the query is returning more that one rows e.g.
Declare @var1 nvarchar(50)
' select @var1=name from table1'

Putting 'top 1' can resolve the problemĀ  in many cases ( do check the business logic aspects):

' select top 1 @var1=name from table1' Posted on Wednesday, February 4, 2009 2:52 PM SQL Server | Back to top


Comments on this post: Subquery returned more than 1 value

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © faizanahmad | Powered by: GeeksWithBlogs.net