编写存储过程

来源:百度知道 编辑:UC知道 时间:2024/07/07 09:35:23
现在又一个存储过程:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE test1_insert

AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
insert into aaa SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','c:\access_test.mdb';'admin';'',住院服务明细);
-- Insert statements for procedure here

END
GO

现在想修改一下其中c:\access_test.mdb和住院服务明细通过参数传递进来

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
CREATE PROCEDURE test1_insert
@press varchar(50), ------参数1 c:\access_test.mdb
@name varchar(30) -------参数2 住院服务明细
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
insert into aaa SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',@press;'admin';'',@name);
-- Insert statements for procedure here

END
GO