Search Results

Keyword: ‘sql’

How to find multiple/duplicate rows with the same value

June 27th, 2008 Rahmansaher No comments

Just a short SQL script which will allow you to find the mutiple rows with the same values in the same table. I am not going to explain what the query does since its a very straight forward query

SQL:
  1. SELECT [column_name]
  2. FROM [tablename]
  3. GROUP BY [column_name]
  4. HAVING count(*)> 1
  5. --  OR
  6.  
  7. SELECT * FROM [TableName] WHERE [ColumnName] IN (
  8. SELECT [ColumnName] FROM (
  9. SELECT count([ColumnName]) AS N, [ColumnName] FROM [TableName]
  10. -- Where Clause If needed
  11. GROUP BY [ColumnName]
  12. )a
  13. WHERE N> 1
  14. )

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

http://support.microsoft.com/kb/139444

Sphere: Related Content

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

September 27th, 2007 Rahmansaher No comments

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:
  1. USE master
  2.  
  3. DECLARE db_names CURSOR FOR
  4. SELECT name FROM sysdatabases
  5. -- Where Clause, Enable if you want to filter out some databases.
  6. --where name like 'databaseIwantName_%' and name not like 'databaseIdontwantName'
  7.  
  8. DECLARE @db_name varchar(100)
  9. DECLARE @QueryString NVARCHAR(500)
  10. DECLARE @UpdateString NVARCHAR(500)
  11.  
  12. OPEN db_names
  13. FETCH NEXT FROM db_names INTO
  14. @db_name
  15. WHILE @@FETCH_STATUS = 0
  16. BEGIN
  17. --PRINT @db_nam
  18. --In My case I used tbl_logins to do multiple select .
  19. SET @QueryString = 'Select * from ' + @db_name + '..logins where login like ''%loginname%'' '
  20. EXEC sp_executesql @QueryString
  21.  
  22. IF @@RowCount> 0
  23. BEGIN
  24. -- This gives the database name if there are any record found with the select state ran above
  25. PRINT @db_name
  26. END
  27.  
  28. --Similarly you can also have any Insert/Update Query IN a Loop.See example below
  29. --In My case I used tbl_logins to do multiple Update At Once.
  30. --SET @UpdateString = 'update ' + @db_name + '..tbllogins set password = ''account_blocked_out'', security_level = 0, approved = 0 where login like ''%loginname%'''
  31. --PRINT @UpdateString
  32. --EXEC sp_executesql @UpdateString
  33.  
  34. FETCH NEXT FROM db_names INTO
  35. @db_name
  36. END
  37.  
  38. CLOSE db_names
  39. DEALLOCATE 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.

 Thanks

Sphere: Related Content

Resume

September 15th, 2007 Rahmansaher Comments off

MUJEEBUR RAHMANSAHER

                                

Solutions-oriented Software Architect and Engineer with broad experience designing, development, configuration, and implementing robust client-focused and internal Web-based systems.

  • In-depth knowledge of object-oriented technologies.
  • 5+ years extensive experience in Cold Fusion (V5.1, V6.1 and 7.0 MX).
  • Extensive experience with design and coding using various programming languages such as C, C++, VB and Java.
  • Extensive experience in usage of ColdFusion Components.
  • Well versed in relational databases, Stored Procedures, DTS, Crystal Reporting tool and back-end technologies.
  • Solid understanding of Networking LAN, WAN, Hubs, IIS, DHCP, TCP/IP, SNMP, Network/Performance monitoring.
  • Eager to constantly improve any and all tools, approaches and code bases to provide the best and most efficient websites.
  • Highly motivated and result oriented.
  • Dynamic communications skills, with success developing and maintaining lasting relationships with key clients and team members, fully communicating technical solutions to users and executives at all levels of technical proficiency.

COMPUTER SKILLS

Languages:        C, C++, JAVA, Assembly and Shell Script MAT lab.

Software:    Dreamweaver, Microsoft. Net, Seagate Crystal Reports, Microsoft Visual Studio, Photoshop, MySQL,MS Office (Word, Excel, Visio, PowerPoint, Outlook, Access, FrontPage).

Web Tools:    ColdFusion (V5.1, V6.1 ,7.0, 8.0 MX) , AJAX, C#, JavaScript, HTML, ASP, VB .Net,  SQL, ASP .Net.

Operating Systems:     Windows 98, 2000, NT, XP, and DOS.

Databases: MySQL, Oracle 8i/9i, IBM DB2, Sybase.

Servers:     Microsoft IIS, Apache, IBM Websphere and ColdFusion Application Server. 

Sphere: Related Content

Categories: Technical Tags:

Some Windows Run Commands

January 8th, 2007 Rahmansaher 1 comment

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

Sphere: Related Content

Categories: Technical Tags: