[dba-SQLServer] Stored Procedure help

Stuart McLachlan stuart at lexacorp.com.pg
Thu Oct 8 16:48:44 CDT 2015


That doesn't make sense.  You don't have to have a select in a stored procedure at all.

This works fine for me:

CREATE PROCEDURE test2
AS
BEGIN
RETURN 1
END
GO


But if you really want a select, this works just as well:

CREATE PROCEDURE test3
AS
BEGIN
SELECT 1
END
GO



On 8 Oct 2015 at 12:21, John Colby wrote:

> Yes but this doesn't work at the bottom of my stored procedure, I have
> already tried it.
>
> I have perhaps 10 Common Table Expressions.  At the bottom, below all
> of those CTEs I MUST HAVE a select statement or the compiler
> complains.
>
> The select statement can be anything, it doesn't have to reference one
> of the CTEs but it has to be a select.
>




More information about the dba-SQLServer mailing list