本文介绍了组织实验室样本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我有一张包含实验室样本的表格。 构建一个验证样本的应用程序。 验证后,我有一个存储过程,它可以将实验室样本标记为好或坏。 为好样本分配一个ID,稍后将使用来显示表单中的样本。我需要的存储过程是对实验室样本进行排序。 样本表格将包含10个样本,因此序列必须计算每个记录并为其分配值。 所有lab 记录按日期组织,并且有一列包含每条记录的插入日期。  $ 插入查询的外观如何算上记录? DestinLoc将是我将在序列中写入值的字段。 当前插入记录的SQL I是: USE [ctc_custom] GO / ******对象:StoredProcedure [dbo]。[sp_HPLC_UpdateProcessed]脚本日期:1/31/2019 4: 02:46 PM ****** / SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO - ========= ==================================== - 作者:< Cam Evenson> - 创建日期:< 12/20/2018> - 说明:<处理完数据后,将已处理标志更新为True> - ============================================ = ALTER PROCEDURE [dbo]。[sp_HPLC_UpdateProcessed] - 在这里添加存储过程的参数 @TestID int, @Validation bit, @Destination Nvarchar(50), @DestinLoc Int AS BEGIN - 添加SET NOCOUNT ON以防止的额外结果集 - 干扰SELECT语句。 SET NOCOUNT ON; UPDATE [dbo]。[HPLC_Params] SET [已处理] = 1, [验证] = @验证, [目的地] = @Destination, [ DestinLoc] = @DestinLoc FROM [dbo]。[HPLC_Params] WHERE [TestID] = @TestID END 解决方案 Hi Cam,   抱歉,我不清楚存储过程的逻辑。你能告诉我们存储过程的目标吗?为了让我们更好地理解,请为您提供一些示例数据,用于您的表格和您想要获得的目标表格。   此外,从代码中你发布了,我看到了更新声明。请告诉我们您是否要将update语句更改为insert语句。   最好的问候, Emily I have a table which contains lab samples.  Build an application which validates the samples.  After validation, I have a stored procedure which either flags the lab sample as good or bad.  The good samples are assigned an ID which will later be used to show the sample in a form. What I need the stored procedure to do is sequence the lab samples.  The sample form will contain 10 samples, so the sequence has to count through each record and assign it a value.  All the lab records are organized by date and there is a column containing the insert date of each record. What would the insert query look like to count the records? DestinLoc would be the field which I would write the value in the sequence.The SQL I current have which inserts records is:USE [ctc_custom]GO/****** Object: StoredProcedure [dbo].[sp_HPLC_UpdateProcessed] Script Date: 1/31/2019 4:02:46 PM ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGO-- =============================================-- Author:<Cam Evenson>-- Create date: <12/20/2018>-- Description:<Updated the Processed Flag to True once the data has been processed>-- =============================================ALTER PROCEDURE [dbo].[sp_HPLC_UpdateProcessed]-- Add the parameters for the stored procedure here@TestID int,@Validation bit ,@Destination Nvarchar(50),@DestinLoc IntASBEGIN-- SET NOCOUNT ON added to prevent extra result sets from-- interfering with SELECT statements.SET NOCOUNT ON;UPDATE [dbo].[HPLC_Params]SET [Processed] = 1,[Validation] = @Validation,[Destination] = @Destination,[DestinLoc] = @DestinLocFROM [dbo].[HPLC_Params]WHERE [TestID] = @TestIDEND 解决方案 Hi Cam, Sorry, I am not clear about the logic for the stored procedure. Could you please tell us the goal for the stored procedure. In order to make us understand better, please provide us some sample data for your table and the target table you want to get. Besides, from the code you posted, I saw a update statement. Please tell us whether you want to change the update statement to the insert statement. Best Regards,Emily 这篇关于组织实验室样本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-06 00:04