Email Article To a Friend View Printable Version

SQL SNIPPET: Instant Print a Message from within a Batch

SQL Server 2005

Following on from Leo Pasta's lead, I've created two stored procedures to make printing out a message without waiting for a batch or transaction to completed. InstantPrint and InstantPrintTime



Share
  • Facebook
  • Google Bookmarks
  • Ask
  • LinkedIn
  • Socialogs
  • Wikio
  • Digg
  • Twitter
  • SlashDot
  • Reddit
  • MySpace
  • Del.icio.us
  • Blogter
  • BlogMemes
  • Yahoo Buzz




Email Article To a Friend View Printable Version

How To: Configure a For Loop Container

Integration Services 2005 / SSIS (DTS)
  1. Start in the package Control Flow, with no object selected (Press ESC in the main window).
  2. Right click the background in the package, and select Variables

  3. Add a variable called LoopIteration with the Int32 data type in the package.
  4. Add a For Loop Container to the package

  5. Edit the For Loop Container by double-clicking it, or right-clicking it and choosing Edit.
  6. Set the InitExpression to @[User::LoopIteration]=0
  7. Set the EvalExpression to @[User::LoopIteration]<5 where 5 would is the number of loops you want to run.
  8. Set the AssignExpression to @[User::LoopIteration]=@[User::LoopIteration]+1
  9. Your settings should now look like this:



Share
  • Facebook
  • Google Bookmarks
  • Ask
  • LinkedIn
  • Socialogs
  • Wikio
  • Digg
  • Twitter
  • SlashDot
  • Reddit
  • MySpace
  • Del.icio.us
  • Blogter
  • BlogMemes
  • Yahoo Buzz






Email Article To a Friend View Printable Version

Answer: How do you create a byte with the value of 00000001 in SQL Server?

SQL Server 2005

My team mate Pi asked me today: how do you create a byte with the value 00000001 in SQL Server?

The answer is to create an integer representation of the byte's value, and cast it to binary.

SELECT CAST(CAST(1 AS TINYINT) AS BINARY(1))

The output in Management Studio is: 0x01 (Management Studio outputs binary fields in Hex format). Hex 0x01 = Bits 0000001.



Share
  • Facebook
  • Google Bookmarks
  • Ask
  • LinkedIn
  • Socialogs
  • Wikio
  • Digg
  • Twitter
  • SlashDot
  • Reddit
  • MySpace
  • Del.icio.us
  • Blogter
  • BlogMemes
  • Yahoo Buzz






Email Article To a Friend View Printable Version

Hey Yo! SQLCMD may truncate your XML!

SQL Server 2005

While trying to use SQLCMD to produce an app.config file, I encountered problems with the output being truncated.

The script was similar to:

DECLARE @appconfig XML
SET @appconfig = '<configuration></configuration>'
... Insert configuration nodes
-- Output the config
SELECT @appconfig as ApplicationConfiguration

The default options for SQLCMD produced output like:

ApplicationConfiguration
-------------------------
<configuration><connecti

(the value was a little longer, but cut off at the end)

Clearly the xml was not valid. There's header text included, corrupted tags, and missing closing tags. So I hunted through books online and google for an answer.

Turns out I needed to use the -y 0 option, which will output xml columns up to 1MB in size.

Also the -h-1 (without any spaces) will remove the header from the output.

If you are planning to use SQLCMD to output XML, remember: Hey Yo! -h-1 -y 0!

sqlcmd -h-1 -y 0 ...
<configuration><connection/><configuration>

Read more on SQLCMD Utility Options



Share
  • Facebook
  • Google Bookmarks
  • Ask
  • LinkedIn
  • Socialogs
  • Wikio
  • Digg
  • Twitter
  • SlashDot
  • Reddit
  • MySpace
  • Del.icio.us
  • Blogter
  • BlogMemes
  • Yahoo Buzz






Email Article To a Friend View Printable Version

Working Remotely: Disable Effects for a Better Working Experience

General News Working from home using a remote desktop has turned out to be surprisingly responsive. There's little to no lag, and I can still do most things (except use some windows shortcuts).

My current gripe is that Menus take a while to display because of fancy fade-ins and smooth expansion. It all looks nice when you are sitting in front of a PC, but remotely, it just uses more bandwith and wastes time.

So when you start working remotely, save yourself sometime and turn off Window's lovely effects, and go for a responsive connection: disable the effects.



Share
  • Facebook
  • Google Bookmarks
  • Ask
  • LinkedIn
  • Socialogs
  • Wikio
  • Digg
  • Twitter
  • SlashDot
  • Reddit
  • MySpace
  • Del.icio.us
  • Blogter
  • BlogMemes
  • Yahoo Buzz






Email Article To a Friend View Printable Version

Julian!? Where are you?

General News Well I've definitely been "missing" on my blog lately. Between work commitments, a long daily commute, and personal projects, I've had no time to post much content on my website.

As of last week, I started working some days remotely; from home. Its been quiet a good change, and now that I have less distractions: I get a lot more work done. I've be able to finish off a lot of interrupted tasks. Get my head around how to organise and structure my day when working from home. I'm more focused, planned, and driven. I'm delivering more results each day, and as a result having more time for taking on more responsibilities comfortably.

But working remotely isn't all about work. Its also about re-gaining some of your personal time. I was spending about 10-15 hours per week travelling to work in my car. I planned my travel to try and avoid peak hour traffic, but where my employer is situated there are no direct travel routes. Public transport (commuter train & bus or bus & ferry & bus or bus & bus & bus & bus) would have seen me spending twice as long driving each day. My car has an awesome stereo, so the drive is not too stressful most days.

Ah! Again! Talking about work and the commute! See how I never got time for myself?

So now that I'm actually getting a few days a week working from home, I have time to get more things done. I'm not as tired. My energy level has sky rocketed. And my relationship has definately benefited. I've got time to persue more study, more personal projects, art, catch up with friends, and get back to writing useful tips for other SQL Server users.

Work has also benefitted. I've started to take an interest in managing myself more and co-ordinating my work with others better. Whilst working from home is ultimately a selfish want, it is definately improving my team skills.

So over the next coming weeks, expect a lot more from me. I'll be posting regularly on SQL Server 2005, including scalability with Service Broker and Notfication Services, Management Studio, and Visual Studio for Database Professionals especially Unit Tests.

So if you have any lagging questions or a SQL problem you'd like some tips for, send me an email sqlquestiokuiters.id.au

Excitedly home,
Julian






Share
  • Facebook
  • Google Bookmarks
  • Ask
  • LinkedIn
  • Socialogs
  • Wikio
  • Digg
  • Twitter
  • SlashDot
  • Reddit
  • MySpace
  • Del.icio.us
  • Blogter
  • BlogMemes
  • Yahoo Buzz






Email Article To a Friend View Printable Version

How to Connect to a SQL Server Compact Edition Database with Management Studio

SQL Server 2005 Compact Edition

Open a new connection by choosing File menu -> Connect Object Explorer in SQL Server Management Studio.

Change the Server Type to SQL Server Compact Edition.

For Database file: put the full path to an existing SQL Server Compact Edition .sdf file; click the drop-down button, and select New Database or Browse to locate a .sdf file.

Enter a password if required.



Share
  • Facebook
  • Google Bookmarks
  • Ask
  • LinkedIn
  • Socialogs
  • Wikio
  • Digg
  • Twitter
  • SlashDot
  • Reddit
  • MySpace
  • Del.icio.us
  • Blogter
  • BlogMemes
  • Yahoo Buzz






Email Article To a Friend View Printable Version

Permanently Redirecting Domain Pages with Geeklog

GeekLog

I have a number of domain names and previously blogged on how to make Geeklog work on all of them.

I’ve decided now to concentrate on one domain name: julian-kuiters.id.au

There is already a number of links to my other domains, so I needed to configure Geeklog to redirect people to the new domain. I think that re-direct pages are pretty annoying, so I opted to use “HTTP/1.1 301 Moved Permanently” to indicate to browsers and search engines the new address.

After quite a few attempts at inserting the redirect code in the theme, I opted to place it in the lib-common.php file.

The basic code to redirect any connects not on my primary domain is:

	if ($_SERVER['SERVER_NAME'] != 'www.julian-kuiters.id.au')
      {
 		header("HTTP/1.1 301 Moved Permanently"); // Convert to GET
		header("Location: http://www.julian-kuiters.id.au" . $_SERVER['REQUEST_URI']);
    		header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');

      }

And I inserted it into the function COM_siteHeader of lib-common.php

function COM_siteHeader( $what = 'menu', $pagetitle = '', $headercode = '' )
{
    global $_CONF, $_TABLES, $_USER, $LANG01, $LANG_BUTTONS, $LANG_CHARSET,
           $LANG_DIRECTION, $_IMAGE_TYPE, $topic, $_COM_VERBOSE;


	//jkuiters 20070420
	if ($_SERVER['SERVER_NAME'] != 'www.julian-kuiters.id.au')
      {
 		header("HTTP/1.1 301 Moved Permanently"); // Convert to GET
		header("Location: http://www.julian-kuiters.id.au" . $_SERVER['REQUEST_URI']);
    		header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');

      }

    // If the theme implemented this for us then call their version instead.

    $function = $_CONF['theme'] . '_siteHeader';

As you can now see, the same url on different domains automatically takes you to the correct site.



Share
  • Facebook
  • Google Bookmarks
  • Ask
  • LinkedIn
  • Socialogs
  • Wikio
  • Digg
  • Twitter
  • SlashDot
  • Reddit
  • MySpace
  • Del.icio.us
  • Blogter
  • BlogMemes
  • Yahoo Buzz






Email Article To a Friend View Printable Version

What I'm Reading 18 April 2007

What I'm Reading

International Considerations for Database and Database Engine Applications
 http://msdn2.microsoft.com/en-us/library/ms190245.aspx

Strategies for Partitioning Relation Data Warehouses in SQL Server
http://www.microsoft.com/technet/prodtechnol/sql/2005/spdw.mspx

Physical Database Storage Design
http://www.microsoft.com/technet/prodtechnol/sql/2005/physdbstor.mspx

International Considerations for Notification Services
http://msdn2.microsoft.com/en-us/library/ms172557.aspx

How MSN Messenger and MSN Hotmail scales with SQL Server 2005
http://www.microsoft.com/technet/prodtechnol/sql/2005/scddrtng.mspx

Scaling out SQL Server 2005
http://msdn2.microsoft.com/en-us/library/aa479364.aspx

Database Mirroring FAQ
http://www.microsoft.com/technet/prodtechnol/sql/2005/dbmirfaq.mspx

Database Mirroring
http://www.microsoft.com/technet/prodtechnol/sql/2005/dbmirror.mspx

SQL Server 2005 Mission Critical High Availability
http://www.microsoft.com/technet/prodtechnol/sql/themes/high-availability.mspx

SQL Server 2005 High Availability
http://www.microsoft.com/sql/technologies/highavailability/default.mspx

SQL Server 2005 Failover Clustering White Paper
http://www.microsoft.com/downloads/details.aspx?FamilyID=818234dc-a17b-4f09-b282-c6830fead499&DisplayLang=en

Achieving Massive Scalability with SQL Server
http://www.sql-server-performance.com/dk_massive_scalability.asp

Clustering
http://www.sql-server-performance.com/rn_sql_server_clustering_2000_to_2005_1.asp

SQL Server 2005 Clustering Best Practices
http://www.sql-server-performance.com/bm_clustering_best_practices.asp



Share
  • Facebook
  • Google Bookmarks
  • Ask
  • LinkedIn
  • Socialogs
  • Wikio
  • Digg
  • Twitter
  • SlashDot
  • Reddit
  • MySpace
  • Del.icio.us
  • Blogter
  • BlogMemes
  • Yahoo Buzz






Email Article To a Friend View Printable Version

SQL Server 2005 - Service Pack 2a (SP2a) Update

SQL Server 2005

Downloaded and installed Service Pack 2 for SQL Server 2005? Well here's a reason to download and apply it again.

A few days after releasing Service Pack 2 for SQL Server 2005, Microsoft has re-released it with an additional fix for maintenance plans. If you have already applied SP2, you will need to apply this critical patch. If you are not sure if the updated service pack 2a has been applied to a server, this kb article explains how to check the affected files.

The new Service Pack (SP2a) includes all the fixes for SP2, as well as improvements to the engine and tools.

While you are at it, don't forget that Updated SQL Server 2005 Books Online (help) Available Now (Feb 2007).



Share
  • Facebook
  • Google Bookmarks
  • Ask
  • LinkedIn
  • Socialogs
  • Wikio
  • Digg
  • Twitter
  • SlashDot
  • Reddit
  • MySpace
  • Del.icio.us
  • Blogter
  • BlogMemes
  • Yahoo Buzz







Gold Coast Aquarium Maintenance | Gold Coast Marine Fish | Gold Coast Tropical Fish
Jewel Jones - Counselling Service - Penrith, Richmond
 
     
 Copyright © 2010 Julian Kuiters
 All trademarks and copyrights on this page are owned by their respective owners.