Quantcast
Channel: IT Answers » SQL Data Set
Viewing all articles
Browse latest Browse all 6

SQL Server 2008 query To Find Columns with incorrect information

$
0
0

This is difficult to expalain so i will try and give you an example

Record                  Surname               Age            Town

1                          Smith                    50             SMITH AB

2                          Jones                     45             Leeds

3                          Patel                      38             PATEL AR

What someone has done is put in the wrong data in town name and instead used details that we put in a different field.

What i want to do is write a query that finds all the wrong ones. in this example it would pull off records 1 and 3

All the wrong records are in a format of SURNAME INITIALS Obviously it would be ideal if they were the same so i could put

where surname = town name,

But although they have part of the column the same it is not fully. Can someone advise the code i would need to use to find this, and if i need to define between capitals and lower too. Many Thanks


Viewing all articles
Browse latest Browse all 6

Latest Images

Trending Articles



Latest Images