I have a table in which products are stored. Below is the schema with data.
What I want to achieve is that I will pass ProductId, Tenure and Range as parameters and it will pick matched record.
So for example, If I have my Parameters ProductId = 21
, Tenure=Duration=1
, and Range =14678
, then it should give me Id=4
as my expected output. Because the range is given 10001-15000.
You can use
parsename()
in concert with atry_convert()
Example
Returns
Note: The
try_convert()
may not be necessary. Not knowing the full scope of your data, it best to avoid false positives.