SQL Server add an identity key to existing table

by ebarcza 10/15/2009 11:54:00 AM

Say you got a table with 1000 records in then realize you did something real stupid(like I did) and not create a key or keyable compound fields. Welp you have to add an identity key but there's no easy way to back fill the entire 1000 records... Until now

step 1.) Script the table to create a new one with a slightly different name.

step 2.) add an identity key, seed it to 1

step 3.) insert all records from the old table into the new one. SQL server will fill the identity column just like you need them

step 4.) drop the old table without a key

step 5.) rename the new table

step 6.) go have a beer! you're done

 

Tags: ,

SQL SERVER

How to Enable a 32-bit Application Pool in IIS 7

by rbellantoni 10/14/2009 10:36:00 AM

 

  1. Open up IIS Manager
  2. Find Application Pools underneath your server name and click on it
  3. Find the App pool that your website is running under
  4. Right Mouse click and select advanced settings
  5. Find the "Enable 32 but Applications" setting
  6. Change value to true

 

 

Via Command Line:

 

Open a command prompt and enter this to switch to 32-bit mode for IIS when on a 64-bit machine

cscript c:\inetpub\adminscripts\adsutil.vbs SET /w3svc/AppPools/Enable32BitAppOnWin64 True

To go back to 64-bit mode enter this

cscript c:\inetpub\adminscripts\adsutil.vbs SET /w3svc/AppPools/Enable32BitAppOnWin64 False

Tags:

Javascript switch statement

by ebarcza 10/13/2009 10:26:00 AM

Skeleton switch statement 

switch(i)
{
case 1:
  do code 1
  break;
case 2:
  do code 2
  break;
default:
 default code

}

Tags:

JavaScript

Saving changes is not permitted - Management Studio

by ebarcza 10/12/2009 11:12:00 AM
Save not permitted in SQL Server 2008 - Management Studio
For those new to SQL Server 2008, you have probably got this message the first time you tried to change a table design.

"Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that can't be re-created or enabled the option Prevent saving changes that require a table to be re-created"

When trying to change the columns in some tables, add columns or change null settings, you'll get the "Saving changes is not permitted" error and something like tables have to be dropped and re-created. The only choice you have is to click cancel, or to choose to save the message to a text file, not very useful.

The solution is pretty easy: Tools -> Options -> Designers, and uncheck the option "Prevent saving changes that require table re-creation".

Tags:

SQL SERVER

How to access popup parent window elements with JavaScript

by ebarcza 10/8/2009 10:28:00 AM
How to access popup parent window elements with JavaScript

The JavaScript code to access parent windows elements is not a complex one. Indeed, all that is needed is the code window.opener. The rest of the element can be addressed as per usual.

If you wanted to submit a form in the parent window for example, the following code would be used:

window.opener.document.myForm1.submit();

As mentioned the code window.opener will access the parent window and document.myForm1 will point to your form (in this case called myForm1) within the document, and then with the function submit(), the information from the form is sent.

Tags: ,

JavaScript

Visual SourceSafe 2005 and Windows Vista Issue

by rBellantoni 10/7/2009 11:54:00 AM

There is a known issue with Vista and connecting to a source safe database. If you just installed sourcesafe on your Vista machine and can connect to it with the administrator but not from inside visual studio and it does not let you add the database to the source list, you need to go this URL:

 http://www.microsoft.com/downloads/details.aspx?FamilyID=8a1a68d8-db11-417c-91ad-02aab484776b&displaylang=en

 and install this update, afterwards it will work fine.

Tags:

ASP.NET Ticker Control

by rBellantoni 10/5/2009 12:10:00 PM

This site has a nice ticker control:

 http://www.devdude.com/tools/js/vertical_ticker/

Tags: , , ,

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen

About the author

Name of author Author name
Something about me and what I do.

E-mail me Send mail

Calendar

<<  September 2017  >>
MoTuWeThFrSaSu
28293031123
45678910
11121314151617
18192021222324
2526272829301
2345678

View posts in large calendar

Recent comments

Tags

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2017

Sign in