Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 query returns more than 1 row

Author  Topic 

pnpsql
Posting Yak Master

246 Posts

Posted - 2012-06-29 : 05:50:11
i have a query where more than 20 tables are used and around 50 columns are getting
derived from this query. when i run this query there is an error occured
that sub query returns mre than one row.

and when i click on message, it leads me in starting of query , not on exact error.becasue there are some table that can
throw more tahn one record . is there any way that i can find the exact error


challenge everything

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2012-06-29 : 06:12:05
Check any subqueries and see how many rows they return - may be a corelated subquery so need to check each row it is run for.
Error message is fairly self explanatory.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

pnpsql
Posting Yak Master

246 Posts

Posted - 2012-06-29 : 06:22:35
BUT WHICH TABLE

challenge everything
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2012-06-29 : 06:25:35
quote:
Originally posted by pnpsql

BUT WHICH TABLE

challenge everything


THE THIRD!


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2012-06-29 : 07:16:18
Test the subqueries.
It depends a lot on how the query is written but can you run parts until you find ouyt what is causing the problem.
Often it is easier for maintenance and troubleshoting and performance analysis to use temp tables.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -