How to write a procedure to check the parameter passed is starts with a letter or not

Hello everyone,

I need a help to write a procedure that check if policyno as a parameter being passed to the procedures is starts with a letter( it could be any letters) or not.

For example policynumber could be ‘K12345678’ or ‘12345’

EXEC ups_checkPolicyno K12345678;
EXEC ups_checkPolicyno 12345;

Please can you help how can I check this condition?

CREATE PROCEDURE ups_checkPolicyno @policy_num varchar(128) AS
IF @policy_num LIKE '[a-zA-Z]%' RETURN 1
ELSE RETURN 0
GO
DECLARE @is_alpha int;
EXEC @is_alpha=ups_checkPolicyno 'K12345678';  SELECT @is_alpha;
EXEC @is_alpha=ups_checkPolicyno '12345';  SELECT @is_alpha;

This is just an example, having it only check for a leading alpha character is not a good use of a stored procedure.

Hi.
What exactly do you mean by the phrase " it could be any letters", any character that is not a digit? So also, for example, UNICODE characters?
You should be more specific about this.
Also, unless yours is a school problem, a function would be more appropriate than a stored procedure.

So when I say any letter thats mean the format of the parameter could be ‘A123456’ or ‘B123456’ so on, up to Z. Basically policy no will start with one letter followed by numbers. I hope it make sense?

Thanks, I will try.