Thursday, August 26, 2010

Insert a backup table back into the original table

1. Get the column list
SELECT COLUMN_NAME + ', ' from INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = '(table name)'

2. Copy the results of this query, and remove the comma from the last record.

3. Run the query:

SET IDENTITY_INSERT originalTableName ON

INSERT INTO originalTableName
(paste column list here)
SELECT
(paste column list here)
FROM (backup table)

SET IDENTITY_INSERT  originalTableName OFF

Note: If your table doesn't have an identity column you can safely disregard the first and last lines of this query.


Reference: http://blog.sqlauthority.com/2007/03/28/sql-server-fix-error-8101-an-explicit-value-for-the-identity-column-in-table-can-only-be-specified-when-a-column-list-is-used-and-identity_insert-is-on/

Wednesday, August 18, 2010

InstallShield error: fatal error -1014: Cannot rename directory to \folder.Bak

I ran into this problem when I was debugging and accidentally left a "pause" at the end of a batch file that was run at the end of installation, which I made execute silently. Thus you see the problem, it was waiting for the user to end the execution by pressing a button, which could not be done since it was not visible.

Solution:
1. The current InstallShield owner's KB article is here (new window).
2. None of their proposed solutions helped, so I figured the installer was still running but I couldn't find it in the process list. So what fixed it was restarting my computer.
3. A less "hammer to kill an ant" approach is to download and use the MSI clean up utility, found here (new window).
There was an error in this gadget