How to find multiple/duplicate rows with the same value

Just a short SQL script which will allow you to find mutiple rows with same values in a table. Since its a very straightforward query, it needs no further explanation :)


select [column_name]
from [tablename]
group by [column_name]
having count(*) > 1
— � OR

Select * from [TableName] where [ColumnName] IN (
select [ColumnName] from (
select count([ColumnName]) as N, [ColumnName] from [TableName]
— Where Clause If needed
group by [ColumnName]
where N > 1


There is a similar article which describes more techniques to follow for managing duplicate rows from a table .

How to write a CURSOR loop over multiple databases in MSSQL 2000

I sure lot of people might want to use the script where they would want to loop over multiple databases sitting on a Single server. In my case, I had to check for  a Login Record  in all the databases since the person left the company and we wanted to disable his/her access. SO I wrote simple CURSOR script in MSSQL 2000. Hope this help to someone. Â

[sql]USE master

SELECT name from sysdatabases
— Where Clause, Enable if you want to filter out some databases.
–where name like ‘databaseIwantName_%’ and name not like ‘databaseIdontwantName’

DECLARE @db_name varchar(100)
DECLARE @QueryString NVARCHAR(500)
DECLARE @UpdateString NVARCHAR(500)

OPEN db_names
–PRINT @db_nam
–In My case I used tbl_logins to do multiple select .
SET @QueryString = ‘Select * from ‘ + @db_name + ‘..logins where login like ”%loginname%” ‘
EXEC sp_executesql @QueryString

IF @@RowCount > 0
— This gives the database name if there are any record found with the select state ran above
PRINT @db_name

–Similarly you can also have any Insert/Update Query IN a Loop.See example below
–In My case I used tbl_logins to do multiple Update At Once.
–SET @UpdateString = ‘update ‘ + @db_name + ‘..tbllogins set password = ”account_blocked_out”, security_level = 0, approved = 0 where login like ”%loginname%”’
–PRINT @UpdateString
–EXEC sp_executesql @UpdateString


CLOSE db_names


 This is something written quick. Here is the Code for your Download. I am sure you can tune it better and if you do, please let me know . I would love to see your Ideas.


Troubleshooting Random null null Error in Coldfusion MX

I have been looking so much for this error in Coldfusion MXÂ but could not find any solution to my problem. null null is a very vague exception error which gets thrown once in a while. Below are the steps I did to troubleshoot and one of them did the solved the problem.

 1) Apply this hot fix from Adobe.

2) Increase the JVM Heap Size. (I increased it  from 512 to 800)

3) Make sure your SELECT query does not pass any corrupt data. It might also be the very cause to  throw the exception error.Turning off query caching signifigantly increased the number of errors, so it seems to be something in the JDBC drivers.

4) Check to see if you have methods that accept parameters passed by reference(like getimagesize()) . Make sure you use right script language for example getimagesize uses VBSCRIPT not JSCRIPT. ( For me this was the case. I removed this method and it stopped the error completely).

Some Windows Run Commands

I thought it would be beneficial to my blog readers to show some of the Windows RUN Commands which will take you directly to the place you want to go !

 To Access.. – Run Command
Accessibility Controls – access.cpl
Add Hardware Wizard – hdwwiz.cpl
Add/Remove Programs – appwiz.cpl
Administrative Tools – control admintools
Automatic Updates – wuaucpl.cpl
Bluetooth Transfer Wizard – fsquirt
Calculator – calc
Certificate Manager – certmgr.msc
Character Map – charmap
Check Disk Utility – chkdsk
Clipboard Viewer – clipbrd
Command Prompt – cmd
Component Services – dcomcnfg
Computer Management – compmgmt.msc
Date and Time Properties – timedate.cpl
DDE Shares – ddeshare
Device Manager – devmgmt.msc
Direct X Control Panel (If Installed)* – directx.cpl
Direct X Troubleshooter – dxdiag
Disk Cleanup Utility – cleanmgr
Disk Defragment – dfrg.msc
Disk Management – diskmgmt.msc
Disk Partition Manager – diskpart
Display Properties – control desktop
Display Properties – desk.cpl
Display Properties (w/Appearance Tab Preselected) – control color
Dr. Watson System Troubleshooting Utility – drwtsn32
Driver Verifier Utility – verifier
Event Viewer – eventvwr.msc
File Signature Verification Tool – sigverif
Findfast – findfast.cpl
Folders Properties – control folders
Fonts – control fonts
Fonts Folder – fonts
Free Cell Card Game – freecell
Game Controllers – joy.cpl
Group Policy Editor (XP Prof) – gpedit.msc
Hearts Card Game – mshearts
Iexpress Wizard – iexpress
Indexing Service – ciadv.msc
Internet Properties – inetcpl.cpl
IP Configuration (Display Connection Configuration) – ipconfig /all
IP Configuration (Display DNS Cache Contents) – ipconfig /displaydns
IP Configuration (Delete DNS Cache Contents) – ipconfig /flushdns
IP Configuration (Release All Connections) – ipconfig /release
IP Configuration (Renew All Connections) – ipconfig /renew
IP Configuration (Refreshes DHCP & Re – Registers DNS) – ipconfig /registerdns
IP Configuration (Display DHCP Class ID) – ipconfig /showclassid
IP Configuration (Modifies DHCP Class ID) – ipconfig /setclassid
Java Control Panel (If Installed) – jpicpl32.cpl
Java Control Panel (If Installed) – javaws
Keyboard Properties – control keyboard
Local Security Settings – secpol.msc
Local Users and Groups – lusrmgr.msc
Logs You Out Of Windows – logoff
Microsoft Chat – winchat
Minesweeper Game – winmine
Mouse Properties – control mouse
Mouse Properties – main.cpl
Network Connections – control netconnections
Network Connections – ncpa.cpl
Network Setup Wizard – netsetup.cpl
Notepad – notepad
Nview Desktop Manager (If Installed) – nvtuicpl.cpl
Object Packager – packager
ODBC Data Source Administrator – odbccp32.cpl
On Screen Keyboard – osk
Opens AC3 Filter (If Installed) – ac3filter.cpl
Password Properties – password.cpl
Performance Monitor – perfmon.msc
Performance Monitor – perfmon
Phone and Modem Options – telephon.cpl
Power Configuration – powercfg.cpl
Printers and Faxes – control printers
Printers Folder – printers
Private Character Editor – eudcedit
Quicktime (If Installed) – QuickTime.cpl
Regional Settings – intl.cpl
Registry Editor – regedit
Registry Editor – regedit32
Remote Desktop – mstsc
Removable Storage – ntmsmgr.msc
Removable Storage Operator Requests – ntmsoprq.msc
Resultant Set of Policy (XP Prof) – rsop.msc
Scanners and Cameras – sticpl.cpl
Scheduled Tasks – control schedtasks
Security Center – wscui.cpl
Services – services.msc
Shared Folders – fsmgmt.msc
Shuts Down Windows – shutdown
Sounds and Audio – mmsys.cpl
Spider Solitare Card Game – spider
SQL Client Configuration – cliconfg
System Configuration Editor – sysedit
System Configuration Utility – msconfig
System File Checker Utility (Scan Immediately) – sfc /scannow
System File Checker Utility (Scan Once At Next Boot) – sfc /scanonce
System File Checker Utility (Scan On Every Boot) – sfc /scanboot
System File Checker Utility (Return to Default Setting) – sfc /revert
System File Checker Utility (Purge File Cache) – sfc /purgecache
System File Checker Utility (Set Cache Size to size x) – sfc /cachesize=x
System Properties – sysdm.cpl
Task Manager – taskmgr
Telnet Client – telnet
User Account Management – nusrmgr.cpl
Utility Manager – utilman
Windows Firewall – firewall.cpl
Windows Magnifier – magnify
Windows Management Infrastructure – wmimgmt.msc
Windows System Security Tool – syskey
Windows Update Launches – wupdmgr
Windows XP Tour Wizard – tourstart
Wordpad – write