trompetaloco
MIS
I have a need to validate certain input parameters on a stored procedure. The situation is this:
The stored procedure performs an order insert. As such, it contains a number of input parameters. Some of these require data validation prior to inserting the order. The validation info is maintained in a table. Here is a simple example of the what I am talking about:
create proc order_insert @p1 char(10), @p2 char(10), @p3 char(10)
as
insert order
values (@p1, @p2, @p3)
go
The validation table would contain this type of data:
ID Parm Value
1 @p2 x
2 @p3 y
I need to read the validation table to get the parameters to validate, then validate the data from the input parameters specified. I would just build the checks into the stored proc, but the validation info needs to be dynamic (ie. they might decide to validate @p1 in the future).
The root of the problem is how to take the value of the "Parm" column (ie. @p2, @p3) and use it to validate the data contained in that parameter(ie. @p2 should contain 'x' and @p3 should contain 'y').
I know that this could be accomplished via a temp table, but I am trying to avoid it.
The stored procedure performs an order insert. As such, it contains a number of input parameters. Some of these require data validation prior to inserting the order. The validation info is maintained in a table. Here is a simple example of the what I am talking about:
create proc order_insert @p1 char(10), @p2 char(10), @p3 char(10)
as
insert order
values (@p1, @p2, @p3)
go
The validation table would contain this type of data:
ID Parm Value
1 @p2 x
2 @p3 y
I need to read the validation table to get the parameters to validate, then validate the data from the input parameters specified. I would just build the checks into the stored proc, but the validation info needs to be dynamic (ie. they might decide to validate @p1 in the future).
The root of the problem is how to take the value of the "Parm" column (ie. @p2, @p3) and use it to validate the data contained in that parameter(ie. @p2 should contain 'x' and @p3 should contain 'y').
I know that this could be accomplished via a temp table, but I am trying to avoid it.