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
What triggers long term care?
What are the types of joins in sql?
What are system databases into sql server (2005/2008) : sql server database administration
How you can change the database name in SQL SERVER?
What are the system database in sql server 2005?
How to stop log file growing too big?
What is the difference between for xml raw and for xml auto?
Which database stores information about replication?
Explain what is the difference between union and union all?
Tell me about pre-defined functions of sql?
Define master database?
Do you know how to make remote connection in database?
What are the main differences between #temp tables and @table variables and which one is preferred?
How do I run a trace in sql server?
Why I am getting this error when renaming a database in ms sql server?