Как вернуть выходные мультиданные в выводе в SQL запрос
insert into build_master(lastUpdatedOn) output inserted.buildId,@versionName,@devrecordId,@developedBy,@reportDate,@scheduledDate, @implementationdate,@closeDate,@environment,@status,@knownIssue,@comments, @functionAdded,@functionUpdated,@defectsFixed into build_versions(buildId,versionName,devrecordId,developedBy,reportDate,scheduledDate, implementationdate,closeDate,environment,status,knownIssue,comments,functionAdded, functionUpdated,defectsFixed) output inserted.buildId,inserted.buildVersionId values(@lastupdatedon);
Подчеркнутая часть будет возвращена из второй таблицы. Во второй таблице есть столбец auto generate id с именем "
buildVersionId. Но я получаю ошибку недопустимого столбца.
Это означает, что предложение output не возвращает данные из второй таблицы.
USE [abc] GO /****** Object: Table [dbo].[build_master] Script Date: 05-Jan-17 10:26:08 PM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[build_master]( [buildId] [bigint] IDENTITY(1,1) NOT NULL, [lastUpdatedOn] [datetime] NOT NULL, CONSTRAINT [PK_build_master] PRIMARY KEY CLUSTERED ( [buildId] 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 /****** Object: Table [dbo].[build_versions] Script Date: 05-Jan-17 10:26:09 PM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[build_versions]( [buildVersionId] [bigint] IDENTITY(1,1) NOT NULL, [buildId] [bigint] NOT NULL, [versionName] [nvarchar](50) NOT NULL, [devrecordId] [int] NOT NULL, [developedBy] [nvarchar](max) NOT NULL, [reportDate] [datetime] NOT NULL, [scheduledDate] [datetime] NULL, [implementationdate] [datetime] NULL, [closeDate] [datetime] NULL, [environment] [nvarchar](50) NOT NULL, [status] [nvarchar](50) NOT NULL, [knownIssue] [nvarchar](max) NULL, [comments] [nvarchar](max) NULL, [functionAdded] [nvarchar](max) NOT NULL, [functionUpdated] [nvarchar](max) NULL, [defectsFixed] [nvarchar](max) NULL, CONSTRAINT [PK_build_versions] PRIMARY KEY CLUSTERED ( [buildVersionId] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY], CONSTRAINT [IX_build_versions] UNIQUE NONCLUSTERED ( [buildId] ASC, [versionName] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO ALTER TABLE [dbo].[build_versions] ADD CONSTRAINT [DF_build_versions_environment] DEFAULT ('Select One') FOR [environment] GO ALTER TABLE [dbo].[build_versions] ADD CONSTRAINT [DF_build_versions_status] DEFAULT ('Open') FOR [status] GO
Что я уже пробовал:
Я попробовал вышеописанный sql-запрос,но бот работает.
David_Wimbley
Вы должны опубликовать свою схему таблицы для build_master и build_versions, чтобы люди могли попытаться воспроизвести вашу проблему.