SQL Server > Stored Procedure

Parameter less stored procedure to return data in SQL Server

How to create parameter less stored procedure to return data from Sql Server database?


To create a stored procedure, follow the step described here, now alter the default stored procedure template like this

CREATE PROCEDURE GetAllPersonalDetails

AS
BEGIN
       -- SET NOCOUNT ON added to prevent extra result sets from
       -- interfering with SELECT statements.
       SET NOCOUNT ON;

     -- Insert statements for procedure here
        SELECT * FROM PersonalDetails
END

Here, we have removed any parameter name, replaced the SELECT statement with selecting all columns and all records (*) from the PersonalDetails database table.

 Views: 1980 | Post Order: 86



Write for us