Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stored procedure parameter data type that allows alphanumeric values

I have a stored procedure for SQL 2000 that has an input parameter with a data type of varchar(17) to handle a vehicle identifier (VIN) that is alphanumeric. However, whenever I enter a value for the parameter when executing that has a numerical digit in it, it gives me an error. It appears to only accept alphabetic characters. What am I doing wrong here?

like image 790
Don Avatar asked Jul 29 '26 07:07

Don


1 Answers

Based on comments, there is a subtle "feature" of SQL Server that allows letters a-z to be used as stored proc parameters without delimiters. It's been there forever (since 6.5 at least)

I'm not sure of the full rules, but it's demonstrated in MSDN (rename SQL Server etc): there are no delimiters around the "local" parameter. And I just found this KB article on it

In this case, it could be starting with a number that breaks. I assume it works for a contained number (but as I said I'm not sure of the full rules).

Edit: confirmed by Martin as "breaks with leading number", OK for "containing number"

like image 66
gbn Avatar answered Aug 01 '26 17:08

gbn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!