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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to test the records

Author  Topic 

Gudiya
Starting Member

14 Posts

Posted - 2012-08-04 : 11:49:16
Hi , I am working as a SQL tester. This is my first project. I have to lots of testing in SQL, which is quite hard for me. I have to join 4 tables in source and 3 tables in target. Both the source and target database are SQL Server 2008. But I don't know how should I test the records and validate it. I used to count to check the number of records but I am unable to figure what are the different ways I can do for testing. So can please somebody atleast give me some basic idea to begin testing and according to that I need to write the test cases as well.

lionofdezert
Aged Yak Warrior

885 Posts

Posted - 2012-08-04 : 13:42:02
If you need to compare records from two databases with same table structure than you can use EXCEPT (different records) and INTERSECT (same records). For example following query will compare records from two tables (but of same structure) and out which are different in both tables.

SELECT * FROM database1.schema(it could be dbo if not mentioned).table
EXECPT
SELECT * FROM database2.schema(it could be dbo if not mentioned).table

to get matching records you can use.

SELECT * FROM database1.schema(it could be dbo if not mentioned).table
INTERSECT
SELECT * FROM database2.schema(it could be dbo if not mentioned).table



--------------------------
http://connectsql.blogspot.com/
Go to Top of Page

Gudiya
Starting Member

14 Posts

Posted - 2012-08-04 : 21:13:01
Thanks for the answer. But what I want to know is that what are the different sql function which I can use to check the records between source and target. If I get the unmatched records , then what are the different logic I can use to check the records.
Go to Top of Page
   

- Advertisement -