Elon's Blog

Stuff that may be of use to someone…

Auto Generate INSERT statements for a SQL Server 2008 Table using SSMS

Posted by Elon B. on November 18, 2011

I was doing some SSIS development for a client and had to generate and alter some test data for some packages.

I already had a table with values in that I wanted to capture via INSERT statements, so that I could chop and change the values as needed.

There is a method in SQL Management Studio 2008 (SSMS) that allows you to create these statements right out of the box for SQL Server 2008, without using any scripts or add-ins from SSMS.

So, for example,  to create the INSERT statements for the Table: HumanResources.Department in the AdventureWorks database.          (Note: Click on images to enlarge)

Chosen TableFig 1

Right Click on the Database Name, select Tasks|Generate Scripts…

Click the Next button on the “Generate and Publish Scripts” dialog box that appears.

From the “Choose Objects” screen, select the table from drop down menu. We are doing this for a single table, but as you can see you can do this for multiple objects or the entire database.

Click Next.

On the next screen, decide where you wish to output the script to. I chose a “new query window” in my example.

Then Press the Advanced Button.

From the Advanced Scripting Options dialog, select the Drop-down options for the “Types of data to script” option.  You can choose (i) Data Only (ii) Schema and data or (iii) Schema only

Click OK, and then select the Next Button. Click the Next button again from the next screen and then the Finish button after the task has completed

In this example, the CREATE TABLE and INSERT statements appear for my chosen database table within a new query window in SSMS.

I can now extract and edit the INSERT statements, as required, to create new or different test data for my SSIS project.

Posted in SQL Server, SSMS, T-SQL | Tagged: , , , , , , | Leave a Comment »

Setting a transparent colour for Pictures and Clip Art in PowerPoint 2007

Posted by Elon B. on November 2, 2011

I wanted to use a clip art image in my Powerpoint 2007 presentation, but needed to remove the white background colour associated with the clipart image.

Here’s how you can do it in PPT 2007

Set Transparent Colour In Pictures or Clip Art in Powerpoint 2007

Set Transparent Colour In Pictures or Clip Art in Powerpoint 2007

I’m sure this can be done in other version of Powerpoint, just search for the Set Transparent colour tool.

Enjoy.

Posted in Windows Office - General, Windows Powerpoint | Tagged: , , , , , , , , | Leave a Comment »

Creating the Torn / Ripped Paper effect in PowerPoint (2007)

Posted by Elon B. on July 21, 2011

I wanted to create a torn paper effect of some code for a client document and did it using PowerPoint 2007. The same principle can be used in PowerPoint 2010.

Steps as follows: (Click on image to enlarge)

You can then select the image and paste into your document etc.

Posted in Windows Office - General, Windows Powerpoint | Tagged: , , , , , , | Leave a Comment »

Improve Windows 7 Shutdown time

Posted by Elon B. on April 25, 2011

Recently my Laptop was taking almost 4 mins to shutdown, which was excessive plus annoying.

I carried out the following steps, which improved my shutdown time to mere seconds. Note the solution involves editing registry entries, which you do at your own risk, so take a backup beforehand.

1: To determine where the issue lay, go to your Control Panel and select Performance Information and Tools.  From the pane on the left select “Advanced Tools”.

2: From the options that appear select View performance details in Event Log.

3: Look for Error and Warnings related to the “Shutdown Performance Monitoring” task for more information.

Event Viewer Shutdown Performance

Event Viewer Shutdown Performance

In my case, as you can see from the image, my total shutdown time was 79935ms or 79.935 seconds. Other entries showed over twice this long.

The main point though, is that in this case 69.532 seconds, or 87% of the shutdown time was related to the “ShutdownKernelTime”.

4: To resolve this I updated the following registry entries.

(Note:  Update the registry at your own risk. You may want to back it up prior to editing it. Run regedit.exe, select FILE, then Export… and then name and save the file to your desired location. Ensure the “Export range” Option is set to All.)

Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control  and change the “WaitToKillServiceTimeout” to 1000. Where 1000 represents 1 second.

Go to  HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management  and change the ClearPageFileAtShutdown data value to 0

ClearPageAtShutdown

ClearPageAtShutdown

You may have to use the registry search (Edit|Find) to see if these Values exist at other Key locations and edit accordingly.

If you ever wish to reset the ClearPageFileAtShutdown Value look here: http://support.microsoft.com/kb/314834

After applying these steps my shutdown time went to only a few seconds.

Hope this helps.

Posted in Windows 7 | Leave a Comment »

 
Follow

Get every new post delivered to your Inbox.