Jenda has asked for the wisdom of the Perl Monks concerning the following question:
In a project I work on I need the admins (not really programmers) to be able to specify pieces of SQL that are to be evaluated to compute the value of some fields. The number of people how have this level of access is very small but nevertheless this gives them too much power. They might cause a lot of problems with incorrect SQL.
They are supposed to use only things like
That is they should be allowed to use only "SET", "IF', "ELSE", "BEGIN", "END", execute a few carefully selected stored procedures, use several selected functions like SUBSTR and CHARINDEX etc.if @variable = '' SET @value = 'No option selected!' else SET @value = 'They selected ' + @variable + '.'
A message saying "You are doing something potentialy dangerous, please don't". would be just great.
Did anyone ever did something like this? Does anyone have a MS SQL (2000) parser that I could use to parse the SQL before I start looking whether they are using only the allowed stuff?
Thanks, Jenda
Always code as if the guy who ends up maintaining your code
will be a violent psychopath who knows where you live.
-- Rick Osborne
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (MS) SQL statement filtering
by cciulla (Friar) on Jun 04, 2003 at 19:03 UTC | |
by Jenda (Abbot) on Jun 04, 2003 at 19:13 UTC |