Creating Insert Statements for SQL Server
Ran across an interesting approach to generating insert statements for SQL Server 2005 (and other variants). If uses a less well known function called master.dbo.fn_varbintohexstr. The approach that was taken was to use the fn_varbintohexstr function to encode the data so you did not need to use cursors or any fancy parsing to handle unicode and quotes in the generated insert statements. I thought it was a bit clever.
Note: you might need to register at SQLServerCentral.com to gain access to the site to read the above linked article.
Clearing Email History Lists in Outlook
One of the great features of Outlook (but also sometimes annoying) is that it remembers all the email addresses of the people that you send email to or receive email from. This makes it really easy for composing emails except for when you get an email address that is spelled incorrectly in that list. That can be extremely frustrating.
Turns out that it is super simple to remove that email address. Just compose and email and start typing the address. When you see it appear, just use the arrows to select the one that is incorrect and press the Delete key. It will be gone forever. Quick and easy.
If you want to clear the entire email history, you can do the following:
- Exit Outlook
- Run Windows Explorer
- Navigate to the C:\Documents and Settings\username\Application Data\Microsoft\Outlook folder (substitute username with your username)
- Find the file with the NK2 extension and rename or delete it.
Remote Desktop with Multiple Monitors / Screens
ASP.NET AJAX Control Toolkit Samples
Most of you probably have already experimented with the Control Toolkit, but just in case you never ran across it, take a look at these Toolkit samples
If you have any questions about them, drop me a comment here.
Calculating Age in T-SQL
Here’s a decent article on calculating the age of a person (or anything else) written by Lynn Pettis. Discusses some pitfalls with leap years.
Using and Managing SQL Server Aliases
I know that not many people I have met in my SQL Server experience have used SQL Aliases. In many ways it is one of the most useful features of SQL Server. Roman Rehak wrote a great article about SQL Server Aliases. You have to be registered to see the full article, but some of the highlights are discussed below.
Creating an alias all depends on which client tools are installed on the computer you are using. Here are the common methods for running the SQL Client Configuration Tool:
- If SQL Server 2000 client tools are installed, use the SQL Client Network Utility and select the Alias tab.
- If SQL Server 2005 client tools are installed, use the SQL Server Configuration Manager and expand the SQL Native Client Configuration node to find the node for Aliases.
- If you do not have any client tools installed, you can still get at the Client Network Utility by executing “cliconfg” from any command prompt.
Aliases are useful in the following scenarios:
- Create an alias that is a friendlier name than the server name itself.
- In a Development/QA/Production environment. Using aliases allow you to keep the code base across your servers the same without having to change source code (sort of related to the last bullet).
- Enforce the use of a particular protocol. If you get the “Cannot generate SSPI context” error you can try creating an alias to force the use of the Named Pipes.
- A distributed environment with multiple servers that reference each other using the Linked Servers feature. You can define the linked servers with the aliases instead of the actual names. This makes future moving of databases and such much easier since you will not need to chnage the linked server names in your code.
- In a high-availability environment to allow you to quickly change the server without changing all your code (such as web applications and such).
I’m sure there are other useful reasons to use aliases, but that covers a few of them that show the power of the alias function.
If you have any other good ideas, please comment on the post.
Great Script for Accessing IIS Configuration Properties
Need to extract information from IIS such as IP Addresses, Host Headers, Log Directories and lots more. This great little script from David Wang does a great job of this. It saved me hours and hours of work going through all my IIS servers manually.
Thanks David!
Useful way to reformat an ASP.NET File Upload control
The guys over at QuirksMode.org have come up with an interesting way to get around the default styling of a File Upload control See the details here:
http://www.quirksmode.org/dom/inputfile.html
So what do you do with all those IIS log files?
You are responsible for one or more Windows web servers and you have all these IIS log files that you want to make some sense out of. If you have some basic SQL skills Microsoft is making available a utility called LogParser which does a great job getting in there and allowing you to query the files directly using some basic SQL syntax. The feature I like the best is the ability to convert the data into a SQL table for manipulation via T-SQL.
Here is a sample of what I did (this would all go on a single line)
c:\”program files”\”log parser 2.2″\LogParser -iCheckPoint:myCheckPoint.lpc -o:SQL -server:localhost -database:IISLogs -createtable:ON “SELECT * FROM ex0810*.log TO IISLogs”
This short command line will read in all log files that start with ex0810 and import them into a table called IISLogs. It will also create a checkpoint file so that if you run the command again it will not import records that have already been imported.
How cool is that?
Once all the importing is done you can leverage the SQL tables using whatever methods you need to.
If you need any help with stuff, send us a note at support at quarksoft.com.
Outlook 2007 Preview Pane made useful…
I finally had upgraded to Outlook 2007 about a month ago and one of the features I found myself using a lot was the Preview feature for attachments. It was great for the PDF and the typical office documents, but there were no preview handlers for files such as WAV. I have a VOIP line that emails me the voice mail messages that have been left so having a WAV previewer would be really useful for me.
During my search for such a feature I ran across a great utility from Gil Azar (and in his post gives credit to lots of others for their help). You can download the ultimate Outlook 2007 preview handler from his site.
If you are interested in some of the technical details Gil discusses them on his page and provides some really great links.
I’ve included parts of Gil’s original post just in case his site disappears one day.
A self-extracting installer, which silently installs Stephen Toub’s MSDN Magazine Managed Preview Handler Framework and Gil’s small addition, can be downloaded here