brixxbox Wiki


SQL Stored Procedure

This app allows you to maintain SQL stored procedures for your workspace DataBase.
In the main editor window you can edit the body of the procedure. The Create/Alter and procedure name must be omitted. After saving the stored procedure will be checked for errors. If no Errors are found it will be added to your DataBase.
It is always good practice to add a brief description for your function. This description is searchable within the list.
Once the stored procedure is successfully added to your DataBase you can directly test it from the query window. Enter your test and execute it. Errors or results will be shown. If u enter multiple tests in the query window, select the one you want by marking the relevant text. If a selection is active, only this will be executed.

Example Usages

Only write the body of the procedure! Is this case the CREATE PROCEDURE ExampleDateToVeryLongString is automatictly generated.
@aReturnString nvarchar(255) output
DECLARE @DayAsString nvarchar(max);
SET @DayAsString =
WHEN DAY(getdate()) = 1 THEN '1st'
WHEN DAY(getdate()) = 2 THEN '2nd'
WHEN DAY(getdate()) = 3 THEN '3rd'
ELSE DATENAME(day, getdate()) + 'th'
SET @aReturnString = ( DATENAME(weekday, getdate())
+ ' ' + @DayAsString + ' of '
+ DATENAME(month, getdate())
+ ' in the Year ' + DATENAME(YEAR, getdate())
This can be checked in the test window.
DECLARE @someReturn nvarchar(255);
EXECUTE dbo.ExampleDateToVeryLongString @someReturn output;
SELECT @someReturn;
Last modified 11mo ago