- If using a SQL job then launch the SQL Server Profiler to trace the exact location of the issue.
- Insert a TOP 1 condition on your SELECT statement (ex:
SELECT top 1 max(sequence) FROM TableName WHERE sequence_id=MemberShip.id)
- Check for duplicate numbers in the affected table (ex:
SELECT * FROM table where id =(SELECT id FROM table1) --where table1 returns more than 1 value)
- Use the aggregate function MAX() which will guarantee that exactly only one value is returned and the subquery is syntactically valid. (ex:
SELECT o.* FROM Northwind.dbo.Orders o)
WHERE o.OrderDate = (SELECT MAX(OrderDate) FROM Northwind.dbo.Orders)
- Use or extend your WHERE clause in the SQL subquery, to filter one or more fields for a unique value.
Connect and collaborate with fellow Blackbaud users.