SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Subquery returned more than 1 value. This is not permitted


Subquery returned more than 1 value. This is not permitted

Author
Message
erics44
erics44
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1276 Visits: 739
I am getting the above error when running the below code.

This has started happening on this bit of sql after a backup and restore

anyone any ideas?

SET IDENTITY_INSERT Seminars ON

INSERT INTO xTable(xID, yID, zID, Title, Hours, MaxPeople, StatusID, IH, PFID)
VALUES
(-1, -1, 71, 'one', 0, 0, 1, 0, 0),
(-2, -2, 71, 'two', 0, 0, 1, 0, 0),
(- 3, - 3, 71, 'three', 0, 0, 1, 0, 0),
(- 4, - 4, 71, 'four', 0, 0, 1, 0, 0),
(- 5, - 5, 71, 'five', 0, 0, 1, 0, 0),
(- 6, - 6, 71, 'six', 0, 0, 1, 0, 0),
(- 7, - 7, 71, 'seven', 0, 0, 1, 0, 0),
(- 8, - 8, 71, 'eight', 0, 0, 1, 0, 0),
(- 9, - 9, 71, 'nine', 0, 0, 1, 0, 0),
(- 10, - 10, 71, 'ten', 0, 0, 1, 0, 0)

SET IDENTITY_INSERT Seminars OFF

thanks in advance
laurie-789651
laurie-789651
UDP Broadcaster
UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)

Group: General Forum Members
Points: 1496 Visits: 1272
There's no subquery there. Have you got any triggers on the table?

The normal cause of this error is a subquery returning > 1 value, which is of course invalid as the return value is going into 1 row.
erics44
erics44
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1276 Visits: 739
ahhhhhhhhhhh

someone has been medalling

thanks for the reply
Sean Lange
Sean Lange
SSC Guru
SSC Guru (64K reputation)SSC Guru (64K reputation)SSC Guru (64K reputation)SSC Guru (64K reputation)SSC Guru (64K reputation)SSC Guru (64K reputation)SSC Guru (64K reputation)SSC Guru (64K reputation)

Group: General Forum Members
Points: 64099 Visits: 17974
erics44 (7/30/2012)
ahhhhhhhhhhh

someone has been medalling

thanks for the reply


If it was a trigger then you seriously need to fix that trigger to handle multiple row statements. Don't just work around the issue by running a whole bunch of single row inserts.

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Modens splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
erics44
erics44
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1276 Visits: 739
nope trigger fixed
Sean Lange
Sean Lange
SSC Guru
SSC Guru (64K reputation)SSC Guru (64K reputation)SSC Guru (64K reputation)SSC Guru (64K reputation)SSC Guru (64K reputation)SSC Guru (64K reputation)SSC Guru (64K reputation)SSC Guru (64K reputation)

Group: General Forum Members
Points: 64099 Visits: 17974
erics44 (7/30/2012)
nope trigger fixed


Sweet!! :-D

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Modens splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
GilaMonster
GilaMonster
SSC Guru
SSC Guru (230K reputation)SSC Guru (230K reputation)SSC Guru (230K reputation)SSC Guru (230K reputation)SSC Guru (230K reputation)SSC Guru (230K reputation)SSC Guru (230K reputation)SSC Guru (230K reputation)

Group: General Forum Members
Points: 230068 Visits: 46344
erics44 (7/30/2012)
nope trigger fixed


And trigger developer educated?

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass


erics44
erics44
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1276 Visits: 739
GilaMonster (7/30/2012)
erics44 (7/30/2012)
nope trigger fixed


And trigger developer educated?


ha, i wish

i wouldnt know where to start to pick appart the existing code in the sql databases

the most annoying thing is the amount of union queries there are, splitting tables and putting them back together and people are continuing to develop like that
TheSQLGuru
TheSQLGuru
SSC-Dedicated
SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)

Group: General Forum Members
Points: 32999 Visits: 8680
erics44 (7/30/2012)
GilaMonster (7/30/2012)
erics44 (7/30/2012)
nope trigger fixed


And trigger developer educated?


ha, i wish

i wouldnt know where to start to pick appart the existing code in the sql databases

the most annoying thing is the amount of union queries there are, splitting tables and putting them back together and people are continuing to develop like that


Please take my business card!! I would LOVE to work in your environment for a week or two! Cool

Best,
Kevin G. Boles
SQL Server Consultant
SQL MVP 2007-2012
TheSQLGuru on googles mail service
erics44
erics44
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1276 Visits: 739
the guy who wrote it is really protective of his code too

if i change anything he has a paddy

i have found myself approaching things in a rubbish way just to stay common with the existing methods

i wrote a couple of table functions and he had a paddy because they weren't stored proceedure (full of unions :-))

if anyone has any ideas how to deal with someone like that then please let me know
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search