USE [InformationSystem]
GO
/****** Object:  StoredProcedure [dbo].[pro_oper]    Script Date: 05/06/2015 16:07:24 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:        <Author,,Name>
-- Create date: <Create Date,,>
-- Description:    <把执行的结果赋给变量>
-- =============================================
ALTER PROCEDURE [dbo].[pro_oper]

AS

DECLARE @strSql NVARCHAR(max)
DECLARE @term_code NVARCHAR(100)

SET @strSql=''

    set @strSql='SELECT top 1 @a=term_code FROM jingpai_line.dbo.st_product_plan 
    where 1=1 and line_code=102 and status=2'
    
    --PRINT @strSql
    
    BEGIN TRY
        exec sp_executesql @strSql,N'@a varchar(100) output',@term_code output --把执行的结果赋给变量@term_code   
    END TRY
    BEGIN CATCH

        RETURN -2
    END CATCH

  print @term_code

 

相关文章:

  • 2022-02-25
  • 2021-12-15
  • 2022-12-23
  • 2021-06-26
  • 2021-07-03
  • 2022-02-25
  • 2021-11-10
  • 2021-05-22
猜你喜欢
  • 2021-07-01
  • 2022-12-23
  • 2021-06-24
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案