I am Having tables T1 and T2 both having same data how to
check (or) compare the data in both table are same?
Answers were Sorted based on User's Feedback
Answer / asharaf ali
(SELECT * FROM @T1
EXCEPT
SELECT * FROM @T2)
UNION
(SELECT * FROM @T2
EXCEPT
SELECT * FROM @T1)
If the above query returned no records, the data in both table are same.
| Is This Answer Correct ? | 7 Yes | 1 No |
Answer / 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 |
Answer / thakur singh rawat
(select * from T1
minus
select * from T2)
union
(select * from T2
minus
select * from T1)
If no rows returns then it means that the two tables
contain the same values or say same.
| Is This Answer Correct ? | 0 Yes | 1 No |
Diffrent types of function
What is the main difference between ‘between’ and ‘in’ condition operators?
How to enter comments in transact-sql statements?
Write a query for primary key constraint with identity key word?
What are the differences between decimal and float in ms sql server?
How to use wildcard characters in like operations in ms sql server?
as a part of your job, what are the dbcc commands that you commonly use for database maintenance? : Sql server database administration
hi. suppose one person goal is strong knowledge on SQL.... suggest me ...if he learns SQL SERVER or ORACLE? which is best?
7 Answers Google, TCS, Unisys,
What are all new concepts in SQL Server 2008? That is Exactly Difference between 2005 to 2008
WRITE A FUNCTION TO DISPLAY THE OUTPUT OF AN EXISTING TABLE RANGE LIKE COMMAM SEPERATED VALUES LIKE RANGE1,RANGE2,...
How to check what was the last restore transaction LSN on Log-Shipping and Mirroring when we doesn't have a Monitor server and Witness server?
Which tcp/ip port does sql server run on? How can it be changed?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)