Wednesday, August 19, 2009

How to delete duplicate record in SQL Database

After you identify duplicate records in a table in SQL database, the next step is how to remove duplicate records.

One way to do this is to copy unique records into temporary table, then delete the original table and then copy the temporary table back.

The below is a web link about how to delete duplicate record.

Deleting Duplicate Records


If you have other ways to remove duplicate records, please share it by leaving comments.

Thursday, August 13, 2009

Duplicate Record in SQL

How do you find duplicate records in a table in SQL database, here is a script

Select First_Name, Last_Name, Email, Phone, count(*)
from Table_ABC
having count(*) > 1
group by First_Name, Last_Name, Email, Phone


How to update record in a table based on values in another table

Update Table_ABC
set First_Name = (select FIRSTNAME from Table_BCD where Table_ABC.Email = Table_BCD.Email)
where exists (select FIRSTNAME from Table_BCD where Table_ABC.Email = Table_BCD.Email)


If the table_BCD have duplicate emails, you can pick the first one by using the following script.

Update Table_ABC
set First_Name = (select top(1) FIRSTNAME from Table_BCD where Table_ABC.Email = Table_BCD.Email)
where exists (select top(1) FIRSTNAME from Table_BCD where Table_ABC.Email = Table_BCD.Email)


I found these scripts are very useful.

HTML text editor - FCKeditor

have you ever used the HTML text editor "FCKeditor".



FCKeditor has a lot of features. From its website, it lists:

  • Multi browser compatibility
  • Outputs XHTML 1.0
  • CSS support for better integration with your web site
  • Font formatting: type, size, color, style, bold, italic, etc
  • Text formatting: alignment, indentation, bullets list, etc
  • Cut, Paste, and Paste as Plain Text, Undo and Redo
  • Paste from Word cleanup with auto detection
  • Link and anchors support
  • Image insertion, with upload and server browsing support
  • Table creation and editing (add, delete rows, etc) - one of the best systems on the market.
  • Table cells editing (size, colors, etc)
  • Form fields
  • Right click context menus support
  • Complete toolbar customization
  • Skins support
  • Plugins support
  • Spell checker
  • Multi-language support with automatic user language detection. Including Right to Left scripting.
  • Complete page editing or just contents.
  • Lightweight and fast
  • Automatic browser detection and customization
  • Integration with ASP, ASP.NET, Java, ColdFusion, Perl, PHP, JavaScript and more.
  • Image and file links upload and server repository browser.
  • For web developers it is easy to install and customize
  • For web users it's simple and easy to use!

Wednesday, August 12, 2009

Private Posts for Blog

How can I keep some post private in my blog. I have this question because I would like to keep some posting just for learning, or note purpose.

Hopefully the Blogspot has this option so that i can set up what posts to share and what posts to keep private.

Tuesday, August 4, 2009

Xcopy Command

Do you know what Xcopy does in dos command? It is more powerful than the copy command. If you would like to copy all the files and sub-folders from one drive to another, you may need xcopy command. Of course, you can use windows explorer interface to do it. But if you would like to write batch file, and run from DOS command, Xcopy is very useful.

The below is an example listed from MicroSoft website:
------------------------------------------------------------------------

Examples

To copy all the files and subdirectories (including any empty subdirectories) from drive A to drive B, type:

xcopy a: b: /s /e

To include any system or hidden files in the previous example, add the/h command-line option as follows:

xcopy a: b: /s /e /h

-----------------------------------------------------------------------------

More information can be found on this webpage from MicroSoft Website.

Thursday, July 30, 2009

List directories or file names into a text file

Sometime you may want to have a list of folders or file names into a text file for other processing. A simple way is to use DOS command to list the folders/file names and then output to a text file instead of on the screen.

For example:
C:> dir *.* >> text.txt
C:>notepad text.txt

It is very easy and simple.

Sunday, July 26, 2009

Virtual Windows



Do you want to work in an office with windows even the room is a windowless room? TheSkyFactory can help you to build virtual windows, virtual ceiling in your office. Look at its website, it is really a good idea since most of the time a virtual windows is better than no window. Plus, you can change the landscape outside the window. It does not list the price, but I guess it wot be cheap. Anyway, I like this idea a lot.

TheSkyFactory Features SkyCeilings and Virtual Windows.