私は 2 つのデータベース AgencyDB (プライマリ DB) と AgencyBackupDB (ユーザーによって AgencyDB から削除された情報) を持っており、両方の DB にこの 2 つのテーブルがあります (ただし、AgencyBackupDB にはテーブル間に関係はありません)。これは私の質問です: すべての情報を選択したいテーブル SabtHazine の AgencyBackupDB から、および関連テーブル Hazine.i からの情報が必要です。これは、テストデータを含むすべてのテーブルのスクリプトです
CREATE TABLE [dbo].[Hazine](
[HazineID] [int] IDENTITY(1,1) NOT NULL,
[HazineGroupID] [smallint] NOT NULL,
[Mablagh] [int] NOT NULL,
[HazineName] [nvarchar](250) NOT NULL,
CONSTRAINT [PK_Hazine] PRIMARY KEY CLUSTERED
(
[HazineID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo].[Hazine] ON
INSERT [dbo].[Hazine] ([HazineID], [HazineGroupID], [Mablagh], [HazineName]) VALUES (1, 1, 20000, N'صابون گل')
INSERT [dbo].[Hazine] ([HazineID], [HazineGroupID], [Mablagh], [HazineName]) VALUES (3, 2, 10000, N'بروس')
SET IDENTITY_INSERT [dbo].[Hazine] OFF
/****** Object: Table [dbo].[SabtHazine] Script Date: 04/07/2013 17:34:59 ******/
CREATE TABLE [dbo].[SabtHazine](
[SabtHazineID] [int] IDENTITY(1,1) NOT NULL,
[HazineID] [int] NOT NULL,
[EndUserName] [nvarchar](20) NOT NULL,
[Tedad] [smallint] NOT NULL,
[sabtHazineDate] [date] NOT NULL,
[Describtion] [nvarchar](500) NULL,
CONSTRAINT [PK_SabtHazine] PRIMARY KEY CLUSTERED
(
[SabtHazineID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET IDENTITY_INSERT [dbo].[SabtHazine] ON
INSERT [dbo].[SabtHazine] ([SabtHazineID], [HazineID], [EndUserName], [Tedad], [sabtHazineDate], [Describtion]) VALUES (6, 3, N'SA', 3, CAST(0xC2360B00 AS Date), N'
')
SET IDENTITY_INSERT [dbo].[SabtHazine] OFF
/****** Object: ForeignKey [FK_SabtHazine_Hazine] Script Date: 04/07/2013 17:34:59 ******/
ALTER TABLE [dbo].[SabtHazine] WITH CHECK ADD CONSTRAINT [FK_SabtHazine_Hazine] FOREIGN KEY([HazineID])
REFERENCES [dbo].[Hazine] ([HazineID])
GO
ALTER TABLE [dbo].[SabtHazine] CHECK CONSTRAINT [FK_SabtHazine_Hazine]
GO