Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
aldehyden
Starting Member
1 Post |
Posted - 2010-07-10 : 04:56:56
|
Hi,I am trying to create a validation/control between two tables, to make sure that there is no needed record missing in any one of them (or if there is any records that should be removed)I am now stuck in how to proceed and need help...Here is a description of the tables I have:TABLE A- holds concatenated from values that together make up the full from value string (kind of key) - the fm_values1 are unique- the to_dimensions is used in an application, to set what other dimensions are required in process handling of transactions from each from_value!- the to_dimensions holds either X or "space" between the slashes - X is a required dimension in step 2...From_values1; to_dimensions;4000/1/10; X/X/ /X4000/1/20; X/X/ /X4000/2/10; X/ /X/X TABLE B- is used to set a to value, depending on From_values1 and from_values2 (dimensions)!From_values1; from_vales2; to_values4000/1/10; 1/A/ /C; 1014000/1/10; 1/B/ /C; 1024000/1/20; 1/A/ /C; 1014000/1/20; 1/B/ /C; 1034000/2/10; 9/ /Q/R; 1014000/2/10; 9/ /Q/W; 202I need to make a query that runs a check, to see that we do not have records in any of the tables that does not correspond to records in the other table.Example of incorrect records that could exist in Table B:EXAMPLE 14000/1/10; 1/ / /C; 101(Incorrect because there is no value in the second / / area, but that dimension is defined as needed in Table A (with an X)!EXAMPLE 23000/1/10; 1/R/ /C; 101(Incorrect because there is no From_values1 that is 3000/1/10 in from_values1 in Table A!)Greatful for any suggestions on how to set up a query that runs such validations! |
|
|
|
|