Allow Stored Procedure To Accept The Values
I new to SQL, and I need one parameter called
@User1 in the stored procedure to accept just 3 words for example ('max', 'low', 'high'), otherwise it should be an error.
I try to type this but it doesn't work I mean it accept any string value of data and I need to just 3 words:
IF @User1 <> 'max' OR @User1 <> 'low' OR @User1 <> 'high' BEGIN SET @ErrorNumber = 3 RETURN 0 END
You need an
AND instead of an
OR between your conditions. As from OP's last comment, to also make it case insensitive:
IF LOWER(@User1) <> 'max' and LOWER(@User1) <> 'low' and LOWER(@User1) <>'high' BEGIN SET @ErrorNumber = 3 RETURN 0 END
IF LOWER(@User1) NOT IN ('max', 'low', 'high') BEGIN SET @ErrorNumber = 3 RETURN 0 END
- → I can't do a foreign key, constraint error
- → How to implement DbDongle::convertTimestamps as workaround of invalid timestamps with MySql strict
- → MySQL error "Foreign key constraint is incorrectly formed"
- → Eloquent Multitable query
- → "Laravel 5.1" add user and project with userId
- → Database backup with custom code in laravel 5 and get the data upto 10 rows from per table in database
- → Laravel 5.1 QueryException when trying to delete a project
- → Using Array in '->where()' for Laravel Query Building
- → Chaining "Count of Columns" of a Method to Single Query Builder
- → Laravel Eloquent Joining Strange query
- → convert time using mysql laravel 5
- → How to update a column after an expiration date in MySQL?
- → Foreign key constraint fails on existing key