faizan ahmad
Blog Stats
Posts - 14
Articles - 0
Comments - 14
Trackbacks - 0
Home
Archives
Contact
Login
Wednesday, February 04, 2009
Subquery returned more than 1 value
"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 @
Wednesday, February 04, 2009 2:52 PM
|
Feedback (0)
News
Recent Comments
Thanks, just what I needed.
by Kadhim
Yes i got. Thanq very much Ahmad.
by Mayur
Thanks a lot sir..
by farhan
I hate to say it, but this doesn't work. Using th...
by Matt
Thanks great solutions.
by Masoni
Archives
September, 2009 (2)
August, 2009 (4)
March, 2009 (1)
February, 2009 (1)
January, 2009 (6)
Post Categories
SQL Server
SilverLight
.NET
ASP.NET
Web Development: Front End
Other
.NET
ASP.NET
Syndication:
RSS
ATOM
Hosted by
Copyright © faizanahmad