title: SQL Validation of attributes - Different Data Types
body: <p>I have a table that holds all the attribute information for a series of codes. An attribute code is set up to hold only a certain data type. These include numeric, free text and dropdown values from a stored list.</p>
  
  <p>I have created a table that holds all the attribute codes and their allowed values. I am trying to come up with a query that will validate each of the attributes on each of the codes based on the values in the validation table.</p>
  
  <p>I'm trying to stay away from cursors as there is a large amount of codes that need to be checked and I know cursors do not perform very fast with a large number of rows.</p>
  
  <p>Example of Data Table:
  <a href="https://i.stack.imgur.com/oviEh.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oviEh.jpg" alt="enter image description here"></a></p>
  
  <p>Example of Validation Table:
  <a href="https://i.stack.imgur.com/p0cQi.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/p0cQi.jpg" alt="enter image description here"></a></p>
  
  <p>You will notice from the LIST data types that they have a corresponding LIST_CODE and allowed LIST_VALUE. </p>