Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

What triggers long term care?

991


What are the types of joins in sql?

1055


What are system databases into sql server (2005/2008) : sql server database administration

964


How you can change the database name in SQL SERVER?

1132


What are the system database in sql server 2005?

983


How to stop log file growing too big?

954


What is the difference between for xml raw and for xml auto?

974


Which database stores information about replication?

989


Explain what is the difference between union and union all?

950


Tell me about pre-defined functions of sql?

1071


Define master database?

988


Do you know how to make remote connection in database?

901


What are the main differences between #temp tables and @table variables and which one is preferred?

1013


How do I run a trace in sql server?

928


Why I am getting this error when renaming a database in ms sql server?

987