Member_2_6478753
asked on
tsql check field if is a number from 1 to 40 ??
i have field @message selected from
select @message = message from inserted
select @reqport = reqport from inserted
i want to check if this @message is between 1 to 40
maybe the message contain other word i want to check if it's numeric and if @message is a number from 1 to 40
and i want to add for the first one to check if @reqport is 1234 or 4567 or 7890 and the message between 1 to 40
how i can write this using if (
select @message = message from inserted
select @reqport = reqport from inserted
i want to check if this @message is between 1 to 40
maybe the message contain other word i want to check if it's numeric and if @message is a number from 1 to 40
and i want to add for the first one to check if @reqport is 1234 or 4567 or 7890 and the message between 1 to 40
how i can write this using if (
ASKER
i want to match the two restriction in the same time
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
IF @message > 1 and @message < 40
BEGIN
//SOME SQL
END
ELSE
//SOME SQL
same goes for @reqport
IF @reqport = 1234 OR @reqport = 4567 OR @reqport = 7890
BEGIN
//SOME SQL
END
ELSE
//SOME SQL