Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Data validation and proper handling

$
0
0

Environment: SQL Server 2008 R2
Purpose: Data validation and proper handling. If the loaded data mismatch the following fields data range requirements, it will redirect those data into table A, while the right ones go to staging table for loading process
Problem: How to set allowable data values in T-SQL, where splits the valid ones into staging table while the invalid goes to Table A for the following items:

Field#1 form_cd
"R" , "I" , "II", "III", "IV" ,"5" or "5.0", "5.1" , "5.2",
"5.3" , "5.4" , "5.5" , "5.6" , "5.7", "5.8", "5.9", "6.0", "6.1" ,"6.2" , "6.3" , "6.4"
"6.5", "6.6" , "6.7" , "6.8", "6.9"

Field#2 grade_cd
0,0+,1,1+,2,2+,3,3+,4,4+,5

Field#3 SSN is numeric and length not > 9

Field#4 comp_cd
[A,B,C,D, Z]

Field#5  bran_cd
1,2,3,4,A,C,D,F,H,M,N,O,X,Z


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>