I want to create a stored procedure in T-SQL which takes an input parameter itemVal
which is a string.
This parameter takes values in 4 ways:
- item name (name: [pen])
- item key (key: [pen_k2])
- item GUID (guid: [213314-32434-45757]),
- itemCode (code: [12435])
I have declared @itemVal
in the stored procedure. Any user can provide the value in any of the four forms stated above. How I can parse this string in my stored procedure so that it can do the further procedure. As if it is an item name there is a separate procedure to follow. I want to know what users have provided for input variable @itemVal
: item name, item code, item GUID or item key.