What are the challenges you face when working across database platforms? Take the survey
Options

I want to create a stored procedure in T-SQL which takes an input parameter itemVal

anamanam Posts: 1 New member
edited November 16, 2021 8:33AM in SQL Data Compare

itemVal is a string parameter .This parameter takes values in 4 ways:

  1. item name (name: [pen])
  2. item key (key: [pen_k2])
  3. item GUID (guid: [213314-32434-45757]),
  4. 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 variables: item name, item code, item GUID, or item key.



And how to validate this input parameter.

something like if @cropVal is NOT NULL

{{ call a function to pass the cropVal to parse }

Tagged:

Answers

Sign In or Register to comment.