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:
the second procedure
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?
Code:
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
Code:
ALTER PROCEDERE [dbo].[DeleteUsers] AS DELETE FROM all_accounts WHERE userid in (SELECT userid FROM dbo.temp_accounts)
Comment