Class Act

Back to the shelf

C# · Method · ASP.net

Create Stored Procedure

A SQL stored procedure (spDates) and C# code to call it — a starting template for date-related calculations.

Example

How to use Create Stored Procedure:
After the snippet is in your project, call spDates.
var result = spDates();

Code

CREATE OR ALTER PROCEDURE [dbo].[spDates]
    @ParentID INT AS
BEGIN

    SET  NOCOUNT ON;
    
    SELECT n.*
    FROM tblNotes n
    WHERE parentid = @ParentID
    OR notesid = @ParentID
    ORDER BY created DESC
END