我在SQL Server中有两个名为tblGlobalGSTRatesMasterI
和tblGlobalGSTRatesMasterII
的表。现在我想将tblGlobalGSTRatesMasterI
的第一行复制到表tblGlobalGSTRatesMasterII
- 请告知我如何在SQL Server中实现此目的。
两个表都具有相同的结构。
这是表tblGlobalGSTRatesMasterI
的结构:
CREATE TABLE [master].[tblGlobalGSTRatesMasterI]
(
[MasterId] [bigint] IDENTITY(1,1) NOT NULL,
[HSNSAC] [varchar](10) NULL,
[Description] [varchar](500) NULL,
[UnitofMeasurement] [varchar](30) NULL,
[GstIGSTRt] [decimal](6, 2) NULL,
[GstCGSTRt] [decimal](6, 2) NULL,
[GstSGSTRt] [decimal](6, 2) NULL,
[GstUTGSTRt] [decimal](6, 2) NULL,
[GstCessRt] [decimal](6, 2) NULL,
[ExmtCircularNumber] [varchar](20) NULL,
[ExmtCircularDate] [varchar](10) NULL,
[ExmtEffectiveDate] [varchar](10) NULL,
[ExmtGstIGSTRt] [decimal](6, 2) NULL,
[ExmtGstCGSTRt] [decimal](6, 2) NULL,
[ExmtGstSGSTRt] [decimal](6, 2) NULL,
[ExmtGstUTGSTRt] [decimal](6, 2) NULL,
[ExmtGstCessRt] [decimal](6, 2) NULL,
[TdsIGSTRt] [decimal](6, 2) NULL,
[TdsCGSTRt] [decimal](6, 2) NULL,
[TdsSGSTRt] [decimal](6, 2) NULL,
[TdsUTGSTRt] [decimal](6, 2) NULL,
[TdsCessRt] [decimal](6, 2) NULL,
[ExmtTdsCircularNumber] [varchar](20) NULL,
[ExmtTdsCircularDate] [varchar](10) NULL,
[ExmtTdsEffectiveDate] [varchar](10) NULL,
[ExmtTdsIGSTRt] [decimal](6, 2) NULL,
[ExmtTdsCGSTRt] [decimal](6, 2) NULL,
[ExmtTdsSGSTRt] [decimal](6, 2) NULL,
[ExmtTdsUTGSTRt] [decimal](6, 2) NULL,
[ExmtTdsCessRt] [decimal](6, 2) NULL, ------ ****
[SupplyCategory] AS (case when [GstIGSTRt]<=(0.05) then 'Essential' when [GstIGSTRt]>=(0.05) AND [GstIGSTRt]<=(0.12) then 'Standard I' when [GstIGSTRt]>=(0.12) AND [GstIGSTRt]<=(0.18) then 'Standard II' else 'Luxury' end) PERSISTED NOT NULL,
[Code] [varchar](10) NULL,
PRIMARY KEY CLUSTERED
(
[MasterId] 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 ANSI_PADDING OFF
这是表tblGlobalGSTRatesMasterII
的结构:
CREATE TABLE [master].[tblGlobalGSTRatesMasterII]
(
[MasterId] [bigint] IDENTITY(1,1) NOT NULL,
[HSNSAC] [varchar](10) NULL,
[Description] [varchar](500) NULL,
[UnitofMeasurement] [varchar](30) NULL,
[GstIGSTRt] [decimal](6, 2) NULL,
[GstCGSTRt] [decimal](6, 2) NULL,
[GstSGSTRt] [decimal](6, 2) NULL,
[GstUTGSTRt] [decimal](6, 2) NULL,
[GstCessRt] [decimal](6, 2) NULL,
[ExmtCircularNumber] [varchar](20) NULL,
[ExmtCircularDate] [varchar](10) NULL,
[ExmtEffectiveDate] [varchar](10) NULL,
[ExmtGstIGSTRt] [decimal](6, 2) NULL,
[ExmtGstCGSTRt] [decimal](6, 2) NULL,
[ExmtGstSGSTRt] [decimal](6, 2) NULL,
[ExmtGstUTGSTRt] [decimal](6, 2) NULL,
[ExmtGstCessRt] [decimal](6, 2) NULL,
[TdsIGSTRt] [decimal](6, 2) NULL,
[TdsCGSTRt] [decimal](6, 2) NULL,
[TdsSGSTRt] [decimal](6, 2) NULL,
[TdsUTGSTRt] [decimal](6, 2) NULL,
[TdsCessRt] [decimal](6, 2) NULL,
[ExmtTdsCircularNumber] [varchar](20) NULL,
[ExmtTdsCircularDate] [varchar](10) NULL,
[ExmtTdsEffectiveDate] [varchar](10) NULL,
[ExmtTdsIGSTRt] [decimal](6, 2) NULL,
[ExmtTdsCGSTRt] [decimal](6, 2) NULL,
[ExmtTdsSGSTRt] [decimal](6, 2) NULL,
[ExmtTdsUTGSTRt] [decimal](6, 2) NULL,
[ExmtTdsCessRt] [decimal](6, 2) NULL,
PRIMARY KEY CLUSTERED
(
[MasterId] 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 ANSI_PADDING OFF
GO
答案 0 :(得分:0)
您可以使用此
SET IDENTITY_INSERT [master].[tblGlobalGSTRatesMasterII] ON
INSERT INTO [master].[tblGlobalGSTRatesMasterII]
(
[MasterId],
[HSNSAC],
[Description],
[UnitofMeasurement],
[GstIGSTRt],
[GstCGSTRt],
[GstSGSTRt],
[GstUTGSTRt],
[GstCessRt],
[ExmtCircularNumber],
[ExmtCircularDate],
[ExmtEffectiveDate],
[ExmtGstIGSTRt],
[ExmtGstCGSTRt],
[ExmtGstSGSTRt],
[ExmtGstUTGSTRt],
[ExmtGstCessRt],
[TdsIGSTRt],
[TdsCGSTRt],
[TdsSGSTRt],
[TdsUTGSTRt],
[TdsCessRt],
[ExmtTdsCircularNumber],
[ExmtTdsCircularDate],
[ExmtTdsEffectiveDate],
[ExmtTdsIGSTRt],
[ExmtTdsCGSTRt],
[ExmtTdsSGSTRt],
[ExmtTdsUTGSTRt],
[ExmtTdsCessRt]
)
SELECT TOP 1
[MasterId],
[HSNSAC],
[Description],
[UnitofMeasurement],
[GstIGSTRt],
[GstCGSTRt],
[GstSGSTRt],
[GstUTGSTRt],
[GstCessRt],
[ExmtCircularNumber],
[ExmtCircularDate],
[ExmtEffectiveDate],
[ExmtGstIGSTRt],
[ExmtGstCGSTRt],
[ExmtGstSGSTRt],
[ExmtGstUTGSTRt],
[ExmtGstCessRt],
[TdsIGSTRt],
[TdsCGSTRt],
[TdsSGSTRt],
[TdsUTGSTRt],
[TdsCessRt],
[ExmtTdsCircularNumber],
[ExmtTdsCircularDate],
[ExmtTdsEffectiveDate],
[ExmtTdsIGSTRt],
[ExmtTdsCGSTRt],
[ExmtTdsSGSTRt],
[ExmtTdsUTGSTRt],
[ExmtTdsCessRt]
FROM [master].[tblGlobalGSTRatesMasterI]
SET IDENTITY_INSERT [master].[tblGlobalGSTRatesMasterII] OFF