I am Having tables T1 and T2 both having same data how to
check (or) compare the data in both table are same?

Answer Posted / saravanan p

Declare @chkSameTable int
Select @chkSameTable=count(*) from
((SELECT * FROM ##SameTable
EXCEPT
SELECT * FROM ##SameTable1)
UNION
(SELECT * FROM ##SameTable1
EXCEPT
SELECT * FROM ##SameTable)) DrvTable

If @chkSameTable=0
Print N'The Two Tables are having Same data'
Else
Print N'The Two Tables are having Diferent data'

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

You have to store user responses of ‘yes’ and ‘no’ what kind of data type is best suited for this task?

540


What is key attribute?

520


write an SQL query to list the employees who joined in the month of January?

1161


Explain various On-Delete options in a DB table. Which is the default option?

904


How to check parameter value in stored procedure sql server?

480






What are triggers? How many triggers you can have on a table? How to invoke a trigger on demand?

758


how to control the amount of free space in your index pages? : Sql server database administration

604


Where is trigger in sql server?

547


Do you know what is openxml in sql server?

617


What is the default value of an integer data type in sql server 2005?

591


What is difference between count (*) and count 1?

522


What are partitioned views?

586


how to invoke a trigger on demand? : Sql server database administration

573


what is normalization? Explain different levels of normalization? : Sql server database administration

667


What is field in algebra?

644