日期:2014-05-18  浏览次数:20402 次

哪里有存储过程的教程下载??
哪里有存储过程的教程下载??

------解决方案--------------------
知道sql写的方式,会增删改查,剩下的就是sql语句的使用的
一些例子
SQL code

---------------添加的存储过程
-- ===========================================
-- Author:        <Author Name : Charry Chen>
-- Create date: <Create Data : 2007-5-14>
-- Description:    <Description : 添加科室信息>
-- ===========================================
ALTER PROCEDURE [dbo].[OfficeInfo_AddOfficeInfo]
(
        @Office_Name nvarchar(50),
        @Phone nvarchar(30),
        @Position nvarchar(100),
        @Director_Name nvarchar(50)
        
)
AS
begin
    INSERT INTO OfficeInfo
    (
        Office_Name,
        Phone,
        Position,
        Director_Name
    )

    VALUES
    (
        @Office_Name,
        @Phone,
        @Position,
        @Director_Name
    )
End
-----------------------更新的存储过程
-- =============================================
-- Author:        <Author Name : Charry Chen>
-- Create date: <Create Data : 2007-5-14>
-- Description:    <Description : 更新科室信息>
-- =============================================
ALTER PROCEDURE [dbo].[OfficeInfo_UpdateOfficeInfo]
(
        @Office_ID int,
        @Office_Name nvarchar(50),
        @Phone nvarchar(30),
        @Position nvarchar(100),
        @Director_Name nvarchar(50)    
    
)
AS
BEGIN
    update OfficeInfo 
    set
        Office_Name = @Office_Name ,
        Phone = @Phone,
        Position = @Position,
        Director_Name = @Director_Name

    where Office_ID= @Office_ID
END
-- =============================================
-- Author:        Marry
-- Create date: 2007-02-14
-- Description:    Add or Update Larger=
-- ================================================ 更新或删除
ALTER PROCEDURE [dbo].[mis_SystemSetup_AddorUpDateLargerUpload] 
    @radix    Int,
    @taskNum  Int,
    @PRI      Nvarchar(50),
    @dateTime Datetime
AS
BEGIN
SELECT *
FROM   FtpSecondUpLoadMaintenance
IF     @@Rowcount < = 0
INSERT INTO FtpSecondUpLoadMaintenance
(
    radix,
    taskNum,
    PRI,
    dateTime
)
VALUES
( 
   @radix,
   @taskNum,
   @PRI,      
   @dateTime
)
ELSE
    UPDATE FtpSecondUpLoadMaintenance
    SET 
        radix = @radix,
        taskNum = @taskNum,
        PRI= @PRI, 
        dateTime = @dateTime
END
--------------------------更新
ALTER PROCEDURE [dbo].[mis_SystemSetup_DeleteTifFolderPathInfo] 
     @TifID    int,
     @IsUsing        INT OUTPUT
AS
SELECT Flag 
FROM   TifFolderPath
WHERE  Flag = 0 And TifFolderPath_ID = @TifID
IF  @@Rowcount > 0
UPDATE 
        TifFolderPath
SET
        InActive=0,
        @IsUsing = 0
WHERE
        TifFolderPath_ID = @TifID
ELSE 
    SET 
        @IsUsing = 1
----删除的存储过程

-- ==========================================
-- Author:        <Author Name : Charry Chen>
-- Create date: <Create Data : 2007-5-14>
-- Description:    <Description : 删除科室信息>
-- ==========================================
ALTER PROCEDURE [dbo].[OfficeInfo_DelOfficeInfo]
(
   @Office_ID int
)
AS
BEGIN
    DELETE From OfficeInfo 
    where Office_ID = @Office_ID  
END

----查找
----排序
-- ===========================================
-- Author:        <Author Name : Charry Chen>
-- Create date: <Create Data : 2007-5-14>
-- Description:    <Description : 获得科室信息>
-- ===========================================
ALTER PROCEDURE [dbo].[OfficeInfo_GetAllOfficeInfo]
AS
BEGIN
    SELECT Office_ID,Office_Name,Phone,Position,Director_Name from  OfficeInfo
    order by Office_ID asc/desc
END