Adding the SQL Report Parameters
Create the report parameters using a set of INSERT statements into the ReportParam table.
The parameterizations are of the form:
[ Operand1 Value1 Operand2 Value2 FieldName ]
An expression equivalent to the parameterization is given immediately following each VALUES clause, first in the above format, and second, if necessary, in a more understandable format.
For more information about the ReportParam table and the various parameters, see Analysis/Reporting Schema.
Step 5
INSERT INTO [dbo].[ReportParam] (ReportID, ParamName, ParamDescription, ParamType, DataType, Opnd1, Val1, Opnd2, Val2, FieldName, Ordinal)
VALUES (@ReportID, '[$TopCount]', 'Number of users', ParamType_SelectOrder, DataType_integer, SelectOrderOpnd_Top, '25', 0, '0', "", 1)
[ Select Top, 25, 0, 0, "" ]
INSERT INTO [dbo].[ReportParam] (ReportID, ParamName, ParamDescription, ParamType, DataType, Opnd1, Val1, Opnd2, Val2, FieldName, Ordinal)
VALUES (@ReportID, '[$DateRange]', 'User registration date', ParamType_DateRange, DataType_date, DateRangeOpnd_From, '3/1/2000', 0, '3/30/2000', "DateRegistered", 2)
[ Date From, 3/1/2000, 0, 3/30/2000, DateRegistered ]
[ 3/1/2000 <= DateRegistered <= 3/30/2000 ]
INSERT INTO [dbo].[ReportParam] (ReportID, ParamName, ParamDescription, ParamType, DataType, Opnd1, Val1, Opnd2, Val2, FieldName, Ordinal)
VALUES (@ReportID, '[$Expression]', 'User type', ParamType_Expression, DataType_integer, ExpOpnd_Equals, '1', 0, '0', "UserType", 3)
[ =, 1, 0, 0, UserType ]
[ UserType = 1 ]
INSERT INTO [dbo].[ReportParam] (ReportID, ParamName, ParamDescription, ParamType, DataType, Opnd1, Val1, Opnd2, Val2, FieldName, Ordinal)
VALUES (@ReportID, '[$SingleValue]', 'Email qualifier', ParamType_SingleValue, DataType_text, 0, 'And Email is not Null', 0, 0, "", 4)
[ 0, Email <> Null, 0, 0, "" ]