I have a stored procedure that calls another stored procedure on a different server. I get the error i wrote above. The first procedure is: - set @DB_NAME = (select db_name from all_servers where server_no = @server_no)
-
set @SERVER_ADDRESS = (select server_address from all_servers where server_no = @server_no)
-
DECLARE @exec_statement varchar (100)
-
select @exec_statement = '[' + @SERVER_ADDRESS + '].' + @DB_NAME + 'dbo.DeleteUsers'
-
exec @exec_statement
the second procedure - ALTER PROCEDERE [dbo].[DeleteUsers] AS
-
DELETE FROM all_accounts
-
WHERE userid in (SELECT userid FROM dbo.temp_accounts)
im completely sure that the problem doesn't occur because of the first 2 selects (the db_name and server_address) , so it must be the second procedure, but the second procedure *should* return more then one row (for that i use 'in' instead of '=')! how is this possible?
7 1767 ck9663 2,878
Recognized Expert Specialist
I have a stored procedure that calls another stored procedure on a different server. I get the error i wrote above. The first procedure is: - set @DB_NAME = (select db_name from all_servers where server_no = @server_no)
-
set @SERVER_ADDRESS = (select server_address from all_servers where server_no = @server_no)
-
DECLARE @exec_statement varchar (100)
-
select @exec_statement = '[' + @SERVER_ADDRESS + '].' + @DB_NAME + 'dbo.DeleteUsers'
-
exec @exec_statement
the second procedure - ALTER PROCEDERE [dbo].[DeleteUsers] AS
-
DELETE FROM all_accounts
-
WHERE userid in (SELECT userid FROM dbo.temp_accounts)
im completely sure that the problem doesn't occur because of the first 2 selects (the db_name and server_address) , so it must be the second procedure, but the second procedure *should* return more then one row (for that i use 'in' instead of '=')! how is this possible?
Try isolation:
Run these first and see if there's an error: - set @DB_NAME = (select db_name from all_servers where server_no = @server_no)
-
set @SERVER_ADDRESS = (select server_address from all_servers where server_no = @server_no)
-
select @dbname, @server_address
-
Then run this - DECLARE @exec_statement varchar (100)
-
select @exec_statement = '[' + @SERVER_ADDRESS + '].' + @DB_NAME + 'dbo.DeleteUsers'
-
exec @exec_statement
However, instead of those variables, try and pass the hardcoded value of those variables. You can get it from the select statement you first ran.
It will tell you where the error is.
-- CK
Try isolation:
Run these first and see if there's an error: - set @DB_NAME = (select db_name from all_servers where server_no = @server_no)
-
set @SERVER_ADDRESS = (select server_address from all_servers where server_no = @server_no)
-
select @dbname, @server_address
-
Then run this - DECLARE @exec_statement varchar (100)
-
select @exec_statement = '[' + @SERVER_ADDRESS + '].' + @DB_NAME + 'dbo.DeleteUsers'
-
exec @exec_statement
However, instead of those variables, try and pass the hardcoded value of those variables. You can get it from the select statement you first ran.
It will tell you where the error is.
-- CK
the problem is not in these variables. even if i use select max(db_name) i get the problem. i realy think its the second procedure.
deepuv04 227
Recognized Expert New Member
the problem is not in these variables. even if i use select max(db_name) i get the problem. i realy think its the second procedure.
hi,
I think the following statement is returning more than one vlaue -
-
select db_name from all_servers where server_no = @server_no
-
-
or
-
-
select server_address from all_servers where server_no = @server_no
-
-
execute these two statements alone and see how many rows it is returning
thanks
ck9663 2,878
Recognized Expert Specialist
"Egsakli" what am trying to suggest ;)
-- CK
I said its not these two selects. I tried to execute the program wih hard-coded values ot use the 'max' aggregate but i still get this error.
ck9663 2,878
Recognized Expert Specialist
Then execute this with hard coded values for @server_address and @dbname -
DECLARE @exec_statement varchar (100)
-
select @exec_statement = '[' + @SERVER_ADDRESS + '].' + @DB_NAME + 'dbo.DeleteUsers'
-
exec @exec_statement
-- CK
deepuv04 227
Recognized Expert New Member
hi,
I think the following statement is returning more than one vlaue -
-
select db_name from all_servers where server_no = @server_no
-
-
or
-
-
select server_address from all_servers where server_no = @server_no
-
-
execute these two statements alone and see how many rows it is returning
thanks
Hi,
Did you tried the above code...?
okey change the statements in your procedure to: (just replace SET to SELECT and try ) -
-
select @DB_NAME = (select db_name from all_servers where server_no = @server_no)
-
-
select @SERVER_ADDRESS = (select server_address from all_servers where server_no = @server_no)
-
-
and try ...
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: leegold2 |
last post by:
I tried what's below, seemed OK, so I replaced an "IN" for the "=" in
the subquery below because of the subquery's error message. I thought
w/"IN" I'd get three (3) records returned as expected. But when I tried
"IN" I got my entire DB returned - I don't show that below - it kept
scrolling so I aborted it. What did I do wrong? Seems like the inner
just returns three recs. and should match-up w/the outer for three recs.
too. I'm using 4.1....
|
by: Nachi |
last post by:
Hi,
Urgent Help appreciated....
I am getting resultset with first condition and when try to get the
resutlset from second condition i am getting the above error in
SQL200.
I know that i am getting more then one value in the second condition
but even i am getting more then one value in my first statement
|
by: Rod |
last post by:
I have a client site where the code below has been working happily for at
least four months. The site is using SQL Server 7. The code is ASP.NET
Last week an error appeared related to the following SQL statement.
INSERT INTO OrderItems (ClientID, ProductID, OrderHeaderID, Quantity,
Dispatched, BackOrdered) SELECT ClientID, ProductID, 1371 AS OrderHeaderID,
Quantity, Dispatched, BackOrdered FROM Basket WHERE RequisitionID = 1369
The...
|
by: reap76 |
last post by:
I am running the following query:
if (select IntExternalAccountID from ExternalAccount) = (select IntExternalAccountID from InternalAccount)
select * from InternalAccount
where AccountPurpose=2
and getting the following error
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
What I am attempting is if the values in ColumnA from...
|
by: Shals |
last post by:
Hi,
I'm using Form and a subform control within that form. Main form is
getting data from one table(Buildings) and subform is getting data from
another table(BldgDataByFloor). but both the form and subform are
linked through a child field which is common in both the
tables(BuildingNumber).
Now, whenever I close the form I receive an error
"Subquery returned more than 1 value. This is not permitted when the
| |
by: kiran2nirvan |
last post by:
hi please help in solving this
i am recieving this error"Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression."
for the code
CREATE procedure .
(@frmMasterID int,
|
by: abednegoo |
last post by:
Hi All,
I tried to find the solution for my problem, but i couldn't find it. If my problem is already solved somewhere, please provide me the link...
I'm not a developer myself, but the application manager who needs to solve the issue :) I have got a problem with out software. It throws an error (Subquery returned more than 1 value, blablabla) at me and I cannot see why.
I have this data which is stored in an XSD file. The query is the...
|
by: Aleck |
last post by:
Hie.
I have a trigger that monitors changes to my table fields but I get an error saying subquery returned more than one value.Below is the code for my trigger, hope you will figure out whats happening..
CREATE TRIGGER trgmyTableAuditFields ON myTable
WITH ENCRYPTION
FOR INSERT, UPDATE, DELETE
AS
BEGIN
|
by: neilgilbert1234 |
last post by:
Hi Everyone,
Im sure this is an easyone, im a newbie to anything half complex in sql so any help would be greatly appreaciated.
I have one table that has two values, i need to multiply those values and stick the result back into the table.
I have used the script below but getting an error:
"Subquery returned more than 1 value. This is not permitted when the subquery follows"
Script used:
update dbo.PCProjectEntry
set...
|
by: jideesh |
last post by:
---------------trigger code
create trigger DeletepurchaseItems on table_purchaseitems
for delete,update
as
begin
select * from deleted
update table_STOCK set ostock=(ostock-(select sqty from deleted))
where itemcode=(select itemcode from deleted)and
coid=(select compid from deleted) and fycode=(select financialyear from deleted)
end
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |