25 May 2010

Finding double entries like RecIds via SQL

If you need to find double entries in an SQL DB u can use the following statement:
SELECT COUNT(RECID), RECID
  FROM [ADDRESSSTATE]
GROUP BY RECID HAVING count(RECID) > 1
Another example finding adresses in different countries:
SELECT count([COUNTRYREGIONID]), COUNTRYREGIONID      
  FROM [dbo].[ADDRESS]
  GROUP By COUNTRYREGIONID having COUNT([COUNTRYREGIONID]) > 1
GO
Or to find dublicates for a multi column key
SELECT [DIMENSIONATTRIBUTE]
      ,[ENTITYINSTANCE]
      ,[ISDELETED]
      ,count(DIMENSIONATTRIBUTE)
FROM [dbo].[DIMENSIONATTRIBUTEVALUE]
GROUP BY DIMENSIONATTRIBUTE, ENTITYINSTANCE, ISDELETED HAVING count(DIMENSIONATTRIBUTE) > 1  

18 May 2010

create regfile with regasm

When you need to know what happens to your registry when you reg a Dll just execute the following regasm command and have a look in the created regfile.
This Command only creates the regfile. It will not register the dll.
RegAsm.exe mySuper.dll /regfile:mySuper.reg

"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegAsm.exe" mySuper.dll /regfile:mySuper.reg