Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 28th, 2004, 07:29 AM
Authorized User
 
Join Date: Jun 2003
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default Update problem

Hi evryone
I have the folowing problem
I have two columns id (varchar 20) and parent(varchar 20) in table adreses

Table has 20000 rows and some values in parent column are *
I want those rows to change to x

So this query works fine:

select parent from adreses where parent='*'

but the updete query return error:
update adreses
set parent='x'
where parent= '*'

This is error:
Server: Msg 512, Level 16, State 1, Procedure TR_PromenaAdresnihPodataka, Line 13
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.

Why???
Thanks
 
Old June 28th, 2004, 09:26 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

I think you are missing out something there. The error has got nothing to do with your update statement.

Procedure TR_PromenaAdresnihPodataka, Line 13 Subquery returned more than 1 value

I don't see line 13 there? Are you using this within a procedure (TR_PromenaAdresnihPodataka)? Is there any subquery related with it?

Looks like I have very less information on this, to help you out. May be you can explain more on what you are trying to do actually.

It works fine for me.
Code:
update sheet1 set item_no='****' where item_no='*'
If you are trying this from your Query Analyser, then I assume that you are not selecting/highlighting this update statement (alone) to get it executed, instead all the other statements that you may have tried before and after this update statement are executed to give you that error. Can you check?

Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old June 28th, 2004, 09:28 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post
Default

There is no subquery. You are not telling us the whole story.

I'm guessing you are trying to 'simplify' your post, so you've left out a few things, like the fact that either 'x' or '*' is really a subquery, and not a character value. Post the whole query that is failing.

The error is stating that some subquery is returning more than one row (or more than one column) when a scalar value (e.g. Set parent='x') is required.

Jeff Mason
Custom Apps, Inc.
www.custom-apps.com
 
Old June 29th, 2004, 01:50 AM
Authorized User
 
Join Date: Jun 2003
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks
The problem was with triger





Similar Threads
Thread Thread Starter Forum Replies Last Post
Update problem aceaceace Visual Basic 2005 Basics 6 February 21st, 2007 10:25 PM
Update problem filipczako ADO.NET 6 December 15th, 2005 11:58 AM
Update Problem skwilliams Classic ASP Databases 0 December 1st, 2005 11:02 AM
update problem lamdog ASP.NET 1.0 and 1.1 Basics 1 March 15th, 2005 11:59 PM
update problem Justine Classic ASP Databases 21 May 26th, 2004 04:25 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.