<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-33854586</id><updated>2011-08-23T11:30:37.623-07:00</updated><title type='text'>SELECT [softwareThoughts] from Tyler</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>gone_cat</name><uri>http://www.blogger.com/profile/02153508485029308717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://static.flickr.com/29/212753836_14f08c2c90_m.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>20</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-33854586.post-2356069001239899629</id><published>2007-07-03T16:48:00.000-07:00</published><updated>2007-07-03T16:52:17.611-07:00</updated><title type='text'>SQL Formatting</title><content type='html'>You can buy the RedGate Sql Prompt bundle and it will format your SQL code for you.  You can also do it for free at:&lt;br /&gt;&lt;a href="http://www.wangz.net/cgi-bin/pp/gsqlparser/sqlpp/sqlformat.tpl"&gt;&lt;br /&gt;http://www.wangz.net/cgi-bin/pp/gsqlparser/sqlpp/sqlformat.tpl&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33854586-2356069001239899629?l=selectsoftwarethoughtsfromtyler.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/feeds/2356069001239899629/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33854586&amp;postID=2356069001239899629' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/2356069001239899629'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/2356069001239899629'/><link rel='alternate' type='text/html' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/2007/07/sql-formatting.html' title='SQL Formatting'/><author><name>gone_cat</name><uri>http://www.blogger.com/profile/02153508485029308717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://static.flickr.com/29/212753836_14f08c2c90_m.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33854586.post-116181582919940171</id><published>2006-10-25T15:24:00.000-07:00</published><updated>2006-10-25T15:37:09.206-07:00</updated><title type='text'>SQL Developers: Download SQLPrompt</title><content type='html'>RedGate, the providers of several completely excellent SQL Server-related software products, have a free download called &lt;a href="http://www.red-gate.com/products/SQL_Prompt/index.htm"&gt;SQLPrompt&lt;/a&gt;.&lt;br /&gt;Very well-done, intellisense for your SQL Server connection.  Works in Query Analyzer, VS.Net, SSMS. &lt;br /&gt;&lt;br /&gt;An example of its robustness: having typed "FROM myTable INNER JOIN ", I'll automatically get a list of tables with foreign keys referencing myTable, or with primary keys that myTable references.  Having selected one, then continuing to the ON phrase of my join, SQLPrompt will offer the right expression to complete the join.&lt;br /&gt;&lt;br /&gt;If you go into the advanced options you'll find such goodies as "automatically change keywords to uppercase as I type."&lt;br /&gt;&lt;br /&gt;It gets annoying some times when the software becomes a little confused, but not too often, and then I'll just reach down to the system tray and turn it off.&lt;br /&gt;&lt;br /&gt;/T&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33854586-116181582919940171?l=selectsoftwarethoughtsfromtyler.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/feeds/116181582919940171/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33854586&amp;postID=116181582919940171' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/116181582919940171'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/116181582919940171'/><link rel='alternate' type='text/html' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/2006/10/sql-developers-download-sqlprompt.html' title='SQL Developers: Download SQLPrompt'/><author><name>gone_cat</name><uri>http://www.blogger.com/profile/02153508485029308717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://static.flickr.com/29/212753836_14f08c2c90_m.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33854586.post-116138106119979241</id><published>2006-10-20T13:45:00.000-07:00</published><updated>2006-10-20T14:51:01.353-07:00</updated><title type='text'>Idempotence in idempotence in dropping tables, columns</title><content type='html'>When working on a database with a team of people all making changes, it's a great idea to make  all change scripts &lt;a href="http://en.wikipedia.org/wiki/Idempotent"&gt;idempotent&lt;/a&gt;, which in this case means "always having exactly the same output as the first time it was run."  See &lt;a href="http://haacked.com/archive/2006/07/05/BulletproofSqlChangeScriptsUsingINFORMATION_SCHEMAViews.aspx"&gt;Phil's article &lt;/a&gt;for a great demonstration of the principle and practice.&lt;br /&gt;&lt;br /&gt;I have found that using the object_id() function and the system tables allows me to write a little less code than the information_schema view require - I'm too lazy to type information_schema.referential_constraints too many times.  All tables, indexes, check constraints, default values, and foreign key constraints can be tested for existence using object_id('objectName'), which returns null if the object isn't there in the database.&lt;br /&gt;The syscolumns table can be used to test for column existence.&lt;br /&gt;&lt;br /&gt;Note that in SQL Server 2005, the tables have been renamed to sys.objects and sys.columns.  I haven't tested this with those tables, but with my SQL Server 2005 still allows me to use the table names from SQL Server 2000.&lt;br /&gt;&lt;br /&gt;Be careful with check constraints and foriegn key constraints that are autogenerated by the database system: the names given by one instance of SQL Server will be different from that given by another, so that if you're checking for existence of a constraint named 'FK__tblMyTab_O_9t5325', your script might only be idempotent on one machine.  In fact, it may throw errors on any other instance of the database.&lt;br /&gt;&lt;br /&gt;Two ways to deal with this:&lt;br /&gt;1) When creating database objects, always name your constraints.  This has a slightly higher overhead but can make it much easier to change the thing using DDL later on.  Here's an example of how to achieve that:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;IF object_id('dbo.Apples') is null&lt;br /&gt; CREATE TABLE [dbo].[Apples](&lt;br /&gt;  [Id] [int] IDENTITY(1,1) NOT NULL,&lt;br /&gt;  [Description] [nvarchar](50) ,&lt;br /&gt; CONSTRAINT [PK_Apples_Id] PRIMARY KEY CLUSTERED ([Id] ASC) ,&lt;br /&gt; CONSTRAINT [UKey_Apples] UNIQUE NONCLUSTERED ([Description] ASC)&lt;br /&gt; )&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;IF object_id('dbo.Oranges') is null&lt;br /&gt;BEGIN&lt;br /&gt; CREATE TABLE [dbo].[Oranges](&lt;br /&gt;  [Id] [int] IDENTITY(1,1) NOT NULL,&lt;br /&gt;  [Description] [nvarchar](50) ,&lt;br /&gt; CONSTRAINT [PK_Oranges_Id] PRIMARY KEY CLUSTERED ([Id] ASC) ,&lt;br /&gt; CONSTRAINT [UKey_Oranges] UNIQUE NONCLUSTERED ([Description] ASC)&lt;br /&gt; )&lt;br /&gt;END&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;IF NOT EXISTS (SELECT 1 from syscolumns&lt;br /&gt;  where id = object_id('Apples')&lt;br /&gt;  and name='OrangeId')&lt;br /&gt;BEGIN&lt;br /&gt; ALTER TABLE Apples&lt;br /&gt;  Add OrangeId int not null&lt;br /&gt;  constraint DF_Apples_OrangeId default 1 WITH VALUES&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;IF object_id('FK_Apples_Oranges') IS NULL&lt;br /&gt;BEGIN&lt;br /&gt; ALTER TABLE Apples&lt;br /&gt; ADD CONSTRAINT FK_Apples_Oranges&lt;br /&gt; FOREIGN KEY (OrangeId)&lt;br /&gt; REFERENCES Oranges (Id)&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;IF NOT EXISTS (SELECT 1 FROM syscolumns&lt;br /&gt;  WHERE id = object_id('Apples')&lt;br /&gt;  and name = 'PickedOn')&lt;br /&gt;BEGIN&lt;br /&gt; ALTER TABLE Apples ADD PickedOn DateTime&lt;br /&gt; CONSTRAINT DF_Apples_PickedOn DEFAULT GetDate()&lt;br /&gt;END&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;--Note that if I try to drop the PickedOn column at this point the command will fail&lt;br /&gt;--because of the default value.  Luckily, there's a name associated with that constraint:&lt;br /&gt;&lt;pre&gt;IF object_id('DF_Apples_PickedOn') is not null&lt;br /&gt;BEGIN&lt;br /&gt; ALTER TABLE Apples&lt;br /&gt; DROP DF_Apples_PickedOn&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;if object_id('UKey_Apples') is not null&lt;br /&gt;BEGIN&lt;br /&gt; alter table Apples drop constraint UKey_Apples&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;if object_id('PK_Apples_Id') is not null&lt;br /&gt;BEGIN&lt;br /&gt; alter table Apples drop constraint PK_Apples_Id&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;2) If you already have objects with weird names, you can still find them using the&lt;br /&gt;information_schema views:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;declare @constraint_name sysname,&lt;br /&gt; @cmd varchar(1000)&lt;br /&gt;while exists(    select 1&lt;br /&gt;     from information_schema.referential_constraints&lt;br /&gt;    where constraint_name like 'FK__tblTask%')&lt;br /&gt;begin&lt;br /&gt; SELECT @constraint_name = (&lt;br /&gt;   select top 1 constraint_name&lt;br /&gt;     from information_schema.referential_constraints&lt;br /&gt;    where constraint_name like 'FK__tblTask%')&lt;br /&gt; PRINT 'Dropping constraint ' + @constraint_name&lt;br /&gt; SELECT @cmd = 'ALTER TABLE dbo.tblTask_Object&lt;br /&gt;    DROP CONSTRAINT ' + @constraint_name&lt;br /&gt; EXEC (@cmd)&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33854586-116138106119979241?l=selectsoftwarethoughtsfromtyler.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/feeds/116138106119979241/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33854586&amp;postID=116138106119979241' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/116138106119979241'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/116138106119979241'/><link rel='alternate' type='text/html' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/2006/10/idempotence-in-idempotence-in-dropping.html' title='Idempotence in idempotence in dropping tables, columns'/><author><name>gone_cat</name><uri>http://www.blogger.com/profile/02153508485029308717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://static.flickr.com/29/212753836_14f08c2c90_m.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33854586.post-116120929716585122</id><published>2006-10-18T14:59:00.000-07:00</published><updated>2006-10-18T15:08:17.223-07:00</updated><title type='text'>Performance Follow up: SqlHelper, object[] vs SqlParameter[]</title><content type='html'>On a Q&amp;D performance test as suggested by &lt;a href="http://www.haacked.com"&gt;Phil&lt;/a&gt;, performance seems to differ only negligably, but on average, I (and the report I cited as well) was wrong.&lt;br /&gt;&lt;br /&gt;Calling the methods included in a previous post, 5000 times each,&lt;br /&gt;&lt;pre class="console"&gt;With parameters took 1203.125 milliseconds.&lt;br /&gt;With objects took 1250 milliseconds.&lt;br /&gt;Objects took -46.875 milliseconds less.&lt;/pre&gt;20000 times each:&lt;br /&gt;&lt;pre class="console"&gt;With parameters took 4859.375 milliseconds.&lt;br /&gt;With objects took 5015.625 milliseconds.&lt;br /&gt;Objects took -156.25 milliseconds less.&lt;br /&gt;&lt;/pre&gt;                                                                                                                          &lt;table border="0" cellpadding="1" cellspacing="1" width="800"&gt;       &lt;col width="700"&gt;       &lt;col width="50"&gt;       &lt;col width="50"&gt;     &lt;/table&gt;     If this test is accurrate, it costs pretty much a constant 0.0078 ms to use the SqlHelperParameterCache object to look up the parameters.&lt;br /&gt;&lt;br /&gt;Thanks Phil!  I think if we go by &lt;a href="http://haacked.com/archive/2006/09/13/Premature_Optimization_Considered_Healthy.aspx"&gt;Haacked's recommendations on optimization&lt;/a&gt;, then in this case we should clearly go with the option that renders code most easy to read, write, and maintain.&lt;br /&gt;&lt;table border="0" cellpadding="1" cellspacing="1" width="800"&gt;       &lt;col width="700"&gt;       &lt;col width="50"&gt;       &lt;col width="50"&gt;     &lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33854586-116120929716585122?l=selectsoftwarethoughtsfromtyler.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/feeds/116120929716585122/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33854586&amp;postID=116120929716585122' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/116120929716585122'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/116120929716585122'/><link rel='alternate' type='text/html' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/2006/10/performance-follow-up-sqlhelper-object.html' title='Performance Follow up: SqlHelper, object[] vs SqlParameter[]'/><author><name>gone_cat</name><uri>http://www.blogger.com/profile/02153508485029308717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://static.flickr.com/29/212753836_14f08c2c90_m.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33854586.post-116120371982997493</id><published>2006-10-18T13:15:00.000-07:00</published><updated>2006-10-18T13:35:19.856-07:00</updated><title type='text'>Code Sample: Passing object[] to SqlHelper</title><content type='html'>Thanks, &lt;a href="http://stevenharman.net/blog/"&gt;Steve&lt;/a&gt;.   Of course there should be some code.  Here:&lt;br /&gt;Apologies for the lost indentation: that I can't use CopyAsHtml well at blogger.com is  probably the biggest reason that I should be blogging with &lt;a href="http://subtextproject.com/"&gt;Subtext&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;style type="text/css"&gt; .cf { font-family: Courier New; font-size: 10pt; color: black; background: white; border-top: windowtext 1pt solid; padding-top: 0pt; border-left: windowtext 1pt solid; padding-left: 0pt; border-right: windowtext 1pt solid; padding-right: 0pt; border-bottom: windowtext 1pt solid; padding-bottom: 0pt; } .cl { margin: 0px; } .cb1 { color: green; } .cb2 { color: blue; } &lt;/style&gt; &lt;div class="cf"&gt; &lt;p class="cl"&gt;&lt;span class="cb1"&gt;// Call SqlHelper with the 'params SqlParameter[] overload'&lt;/span&gt;&lt;/p&gt; &lt;p class="cl"&gt;&lt;span class="cb2"&gt;public&lt;/span&gt; &lt;span class="cb2"&gt;void&lt;/span&gt; GetWithSqlParams(SystemUser aUser)&lt;/p&gt; &lt;p class="cl"&gt;{&lt;/p&gt; &lt;p class="cl"&gt;    SqlParameter idParam = &lt;span class="cb2"&gt;new&lt;/span&gt; SqlParameter("@id", aUser.Id);&lt;/p&gt; &lt;p class="cl"&gt;    SqlParameter nameParam = &lt;span class="cb2"&gt;new&lt;/span&gt; SqlParameter("@name", aUser.Name);&lt;/p&gt; &lt;p class="cl"&gt;    SqlParameter emailParam = &lt;span class="cb2"&gt;new&lt;/span&gt; SqlParameter("@name", aUser.Email);&lt;/p&gt; &lt;p class="cl"&gt;    SqlParameter loginParam = &lt;span class="cb2"&gt;new&lt;/span&gt; SqlParameter("@name", aUser.LastLogin);&lt;/p&gt; &lt;p class="cl"&gt;    SqlParameter logoutParam = &lt;span class="cb2"&gt;new&lt;/span&gt; SqlParameter("@name", aUser.LastLogOut);&lt;/p&gt; &lt;p class="cl"&gt;    SqlHelper.ExecuteNonQuery(&lt;/p&gt; &lt;p class="cl"&gt;        Settings.ConnectionString, CommandType.StoredProcedure, "User_Update",&lt;/p&gt; &lt;p class="cl"&gt;                    idParam,&lt;/p&gt; &lt;p class="cl"&gt;                    nameParam,&lt;/p&gt; &lt;p class="cl"&gt;                    emailParam,&lt;/p&gt; &lt;p class="cl"&gt;                    loginParam,&lt;/p&gt; &lt;p class="cl"&gt;                    logoutParam);&lt;/p&gt; &lt;p class="cl"&gt;}&lt;/p&gt; &lt;p class="cl"&gt; &lt;/p&gt; &lt;p class="cl"&gt;&lt;span class="cb1"&gt;// Call SqlHelper with the 'params object[] overload'&lt;/span&gt;&lt;/p&gt; &lt;p class="cl"&gt;&lt;span class="cb2"&gt;public&lt;/span&gt; &lt;span class="cb2"&gt;void&lt;/span&gt; GetWithObjects(SystemUser aUser)&lt;/p&gt; &lt;p class="cl"&gt;{&lt;/p&gt; &lt;p class="cl"&gt;    SqlHelper.ExecuteNonQuery(&lt;/p&gt; &lt;p class="cl"&gt;            Settings.ConnectionString, "User_Update",&lt;/p&gt; &lt;p class="cl"&gt;                aUser.Id,&lt;/p&gt; &lt;p class="cl"&gt;        aUser.Email,&lt;/p&gt; &lt;p class="cl"&gt;        aUser.Name,&lt;/p&gt; &lt;p class="cl"&gt;        aUser.LastLogin,&lt;/p&gt; &lt;p class="cl"&gt;        aUser.LastLogOut);&lt;/p&gt; &lt;p class="cl"&gt;}&lt;/p&gt; &lt;p class="cl"&gt; &lt;/p&gt; &lt;p class="cl"&gt;&lt;span class="cb1"&gt;//  Which is semantically identical with:&lt;/span&gt;&lt;/p&gt; &lt;p class="cl"&gt;&lt;span class="cb2"&gt;public&lt;/span&gt; &lt;span class="cb2"&gt;void&lt;/span&gt; GetWithObjectArray(SystemUser aUser)&lt;/p&gt; &lt;p class="cl"&gt;{&lt;/p&gt; &lt;p class="cl"&gt;    SqlHelper.ExecuteNonQuery(&lt;/p&gt; &lt;p class="cl"&gt;        Settings.ConnectionString, "User_Update",&lt;/p&gt; &lt;p class="cl"&gt;        &lt;span class="cb2"&gt;        new&lt;/span&gt; &lt;span class="cb2"&gt;object&lt;/span&gt;[]&lt;/p&gt; &lt;p class="cl"&gt;            {&lt;/p&gt; &lt;p class="cl"&gt;                aUser.Id,&lt;/p&gt; &lt;p class="cl"&gt;                                aUser.Email,&lt;/p&gt; &lt;p class="cl"&gt;                aUser.Name,&lt;/p&gt; &lt;p class="cl"&gt;                aUser.LastLogin,&lt;/p&gt; &lt;p class="cl"&gt;                aUser.LastLogOut&lt;/p&gt; &lt;p class="cl"&gt;                        });&lt;/p&gt; &lt;p class="cl"&gt;}&lt;/p&gt; &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33854586-116120371982997493?l=selectsoftwarethoughtsfromtyler.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/feeds/116120371982997493/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33854586&amp;postID=116120371982997493' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/116120371982997493'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/116120371982997493'/><link rel='alternate' type='text/html' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/2006/10/code-sample-passing-object-to.html' title='Code Sample: Passing object[] to SqlHelper'/><author><name>gone_cat</name><uri>http://www.blogger.com/profile/02153508485029308717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://static.flickr.com/29/212753836_14f08c2c90_m.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33854586.post-116119528492279173</id><published>2006-10-18T11:08:00.000-07:00</published><updated>2006-10-18T11:14:44.936-07:00</updated><title type='text'>Pass Parameters as Objects to MS Data Access Application Blocks</title><content type='html'>Intuition seems too state that it's better to call the SqlHelper overloads that take SqlParameter[] for the parameters to a stored procedure or query.&lt;br /&gt;&lt;br /&gt;But in fact, you'll get a performance boost in addition to easier coding, by calling the overload that uses object[].  That's because the parameters that get created on the first call to that proc or query get cached, so that the SqlHelper object doesn't have to create the SqlParameter objects anew, but only set their values and then give them to the SqlConnection object.&lt;br /&gt;&lt;br /&gt;Here's a snippet from the &lt;a href="http://www.informit.com/guides/content.asp?g=dotnet&amp;seqNum=339&amp;amp;rl=1"&gt;Informit .Net Reference Guide&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;h3 style="font-style: italic;"&gt;SqlHelperParameterCache&lt;/h3&gt;  &lt;p style="font-style: italic;" nd="27"&gt;Many of the &lt;tt&gt;SqlHelper&lt;/tt&gt; methods query the database to discover stored procedure parameters. This is a huge benefit in that it prevents you from having to write code that creates &lt;tt&gt;SqlParameter&lt;/tt&gt; arrays, but it's woefully inefficient if you do it for every stored procedure call. The &lt;tt&gt;SqlHelperParameterCache&lt;/tt&gt; is a way to provide the convenience of parameter discovery while minimizing the cost. When you call one of the methods that does parameter discovery, &lt;tt&gt;SqlHelper&lt;/tt&gt; checks the parameter cache to see if there has already been a call to that particular stored procedure on the supplied connection or connection string. If so, the parameter types are retrieved from the in-memory cache. If not, the &lt;tt&gt;SqlHelperParameterCache&lt;/tt&gt; object discovers the parameters and then caches them. The result is that the first call to a given stored procedure incurs the cost of discovering the parameters, but subsequent calls get them from the cache, almost free. The cost of getting the parameters from the cache is less than creating the parameter array yourself for each call. The initial hit is expensive, but amortized over the application's lifetime, it's not expensive at all.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33854586-116119528492279173?l=selectsoftwarethoughtsfromtyler.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/feeds/116119528492279173/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33854586&amp;postID=116119528492279173' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/116119528492279173'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/116119528492279173'/><link rel='alternate' type='text/html' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/2006/10/pass-parameters-as-objects-to-ms-data.html' title='Pass Parameters as Objects to MS Data Access Application Blocks'/><author><name>gone_cat</name><uri>http://www.blogger.com/profile/02153508485029308717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://static.flickr.com/29/212753836_14f08c2c90_m.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33854586.post-116102638227652908</id><published>2006-10-16T11:58:00.000-07:00</published><updated>2006-10-16T12:19:42.290-07:00</updated><title type='text'>Stopping the War Problem</title><content type='html'>First, an anecdote from Michael Nagler, department chair of Peace and Conflict Studies at UC Berkeley:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;&lt;em&gt;A woman was in Washington, DC, doing work for an upcoming Anti-War action near the capitol. She happened to wind up in an elevator standing among four men in colorful military outfits.&lt;br /&gt;     Feeling a little uncomfortable, she made polite smalltalk: "What are you gentlemen doing?" One of them proudly responded to the effect of, "We are lobbying for funds to be allocated for a new missle defense system. And what are you doing?"&lt;br /&gt;     "Protesting the actions of the united states military."&lt;br /&gt;Uncomfortable silence followed. Then, as the men filed out of the elevator, one of them turned to her and said quietly, "Hurry up!"&lt;/em&gt;&lt;/span&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="font-family:Times New Roman;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;&lt;span style="font-family:Times New Roman;"&gt;In Nagler's words: This story is indicative of the current state of the United States population.  Out of five:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Times New Roman;"&gt;     One is probably sold that war is the right way to handle today's conflicts.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Times New Roman;"&gt;     Two are probably unsure of what to do and are going along, perhaps because they haven't thought it through all the way.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Times New Roman;"&gt;     One is probably actively doing &lt;em&gt;something&lt;/em&gt; to stop the proliferation of unjust/illegal war.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Times New Roman;"&gt;     ...And at least one knows that the war is wrong, but is depending on others to pave the way.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Times New Roman;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;The message: It does take a little courage to start speaking out against actions that have been proclaimed to be matters of national security.  But if you find yourself among those who agree with the pundits claiming that, in addition to the tragic deaths of many thousands of United States, Afghani and Iraqi citizens, in addition to the deception that is given credit for the US ever gaining support for this war, &lt;strong&gt;&lt;em&gt;the current war and war plans pose severe threats to U.S. security&lt;/em&gt;&lt;/strong&gt;, then by engaging in some dialog, we might all find ourselves in the company of others who agree but who haven't yet known who to talk to about it.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;      And if you have talked much on this topic, then you may have been placed in the difficult position of not knowing how to answer the question, "You say the U.S. should pull out of Iraq, how do you think that should be done?"  The current issue of Harper's Magazine, includes a very well conceived overview of a plan, complete with cost estimates and a very realistic outlook.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;     This issue of Harper's also includes some very good food for thought regarding the U.S. military plans regarding Iran.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33854586-116102638227652908?l=selectsoftwarethoughtsfromtyler.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/feeds/116102638227652908/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33854586&amp;postID=116102638227652908' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/116102638227652908'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/116102638227652908'/><link rel='alternate' type='text/html' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/2006/10/stopping-war-problem.html' title='Stopping the War Problem'/><author><name>gone_cat</name><uri>http://www.blogger.com/profile/02153508485029308717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://static.flickr.com/29/212753836_14f08c2c90_m.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33854586.post-115940012123534139</id><published>2006-09-27T16:26:00.000-07:00</published><updated>2006-09-27T16:48:53.883-07:00</updated><title type='text'>Unzip your files</title><content type='html'>I really don't like the unzip feature that comes with the Windows shell.  Terribly slow if there are many files in the arrchive.&lt;br /&gt;I also don't like 7zip, which I've seen used around.  It frequently isn't able to read zip files.&lt;br /&gt;I &lt;b&gt;do&lt;/b&gt; like &lt;a href="http://icsharpcode.com/OpenSource/SharpZipLib/Download.aspx"&gt;ICSharpCode.SharpZipLib&lt;/a&gt;, an open-source compression library.&lt;br /&gt;&lt;br /&gt;Here's a little PowerShell script that will extract zip files for you:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Param($source, $destination=".")&lt;br /&gt;&lt;br /&gt;$sourceFile = get-item $source&lt;br /&gt;$destDir = get-item $destination&lt;br /&gt;&lt;br /&gt;function using-library {&lt;br /&gt;    param($ns = $(throw "Enter Namespace to import"), [bool]$SuppressOutput = $false)&lt;br /&gt;    &lt;br /&gt;    trap { throw "Could not import Namespace $($ns)" }&lt;br /&gt;    &lt;br /&gt;    if ($SuppressOutput) {&lt;br /&gt;        [void][System.Reflection.Assembly]::LoadWithPartialName($ns)&lt;br /&gt;    } else {&lt;br /&gt;        [System.Reflection.Assembly]::LoadWithPartialName($ns)&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;using-library "ICSharpCode.SharpZipLib" $true&lt;br /&gt;&lt;br /&gt;$unzip = new-object ICSharpCode.SharpZipLib.Zip.FastZip&lt;br /&gt;$unzip.ExtractZip($sourceFile.FullName, $destDir.FullName, "Always", $null, "", "")&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;You'll have to add the assembly to the GAC.  Open a Visual Studio SDK command window and type the command,&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;c:\&amp;gt;gacutil /i &amp;lt;path_to_ICSharpCode.SharpZipLib.dll&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Also, notice that in this script I am still instantiating objects using fully-qualified names.  Can anyone tell me how to import namespaces into the global symbol table within a PowerShell script?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33854586-115940012123534139?l=selectsoftwarethoughtsfromtyler.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/feeds/115940012123534139/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33854586&amp;postID=115940012123534139' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/115940012123534139'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/115940012123534139'/><link rel='alternate' type='text/html' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/2006/09/unzip-your-files.html' title='Unzip your files'/><author><name>gone_cat</name><uri>http://www.blogger.com/profile/02153508485029308717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://static.flickr.com/29/212753836_14f08c2c90_m.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33854586.post-115938279533232708</id><published>2006-09-27T10:56:00.000-07:00</published><updated>2006-09-27T11:46:38.316-07:00</updated><title type='text'>Adding Custom Logging Properties to your Log4Net configuration</title><content type='html'>In the &lt;a href="http://logging.apache.org/log4net/release/release-notes.html#1.2.9-new"&gt;Log4Net release notes&lt;/a&gt; there's a note about now to create your own custom pattern element in the logging configuration, so that, e.g., your conversion pattern might look like:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;  "%-5level %logger - %myConverter - %message%newline"&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Maybe someone can comment on why this would be better than what I will recommend.  Anyways, if you take this approach and want to include information about the actual logging event, you should know two things:&lt;br /&gt;1) subclassing &lt;a href="http://logging.apache.org/log4net/release/sdk/log4net.Layout.Pattern.PatternLayoutConverter.html"&gt;PatternLayoutConverter&lt;/a&gt; instead of &lt;a href="http://logging.apache.org/log4net/release/sdk/log4net.Util.PatternConverter.html"&gt;PatternConverter&lt;/a&gt; will give you a &lt;a href="http://logging.apache.org/log4net/release/sdk/log4net.Layout.Pattern.PatternLayoutConverter.Convert_overload_1.html"&gt;Convert &lt;/a&gt; method that includes a LoggingEvent object.&lt;br /&gt;&lt;br /&gt;2) The state object passed to &lt;a href="http://logging.apache.org/log4net/release/sdk/log4net.Util.PatternConverter.Convert.html"&gt;PatternConverter.Convert&lt;/a&gt; is actually a LoggingEvent object!&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Great.&lt;/span&gt;&lt;br /&gt;I found it easier to create a new appender, which simply added objects to the LoggingEvent's properties collection.&lt;br /&gt;&lt;br /&gt;Here's the appender class:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public class PropertiesExpanderAppender : ForwardingAppender&lt;br /&gt;{&lt;br /&gt;  protected override void Append(LoggingEvent loggingEvent)&lt;br /&gt;  {&lt;br /&gt;      if (null != HttpContext.Current)&lt;br /&gt;      {&lt;br /&gt;          HttpContext context = HttpContext.Current;&lt;br /&gt;          loggingEvent.Properties["USER_IP"] = context.Request.UserHostAddress;&lt;br /&gt;          loggingEvent.Properties["REQUEST_URI"] = context.Request.Url.PathAndQuery;&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;      if (null != UserProperties.CurrentUser)&lt;br /&gt;      {&lt;br /&gt;          UserProperties userProperties = UserProperties.CurrentUser;&lt;br /&gt;          loggingEvent.Properties["USER_EMAIL"] = userProperties.UserName;&lt;br /&gt;          loggingEvent.Properties["USER_NAME"] = userProperties.Name;&lt;br /&gt;          loggingEvent.Properties["USER_ID"] = userProperties.UserId;&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;      // Delegate to base class which will forward&lt;br /&gt;      base.Append(loggingEvent);&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Here are the important snippets from the log4net configuration:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;appender name="PropertiesExpanderAppender" type="NameSpace.PropertiesExpanderAppender"&amp;gt;&lt;br /&gt; &amp;lt;appender-ref ref="RollingLogFileAppender" /&amp;gt;&lt;br /&gt;&amp;lt;/appender&amp;gt;&lt;br /&gt;&amp;lt;appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"&amp;gt;&lt;br /&gt; ...&lt;br /&gt; &amp;lt;layout type="log4net.Layout.PatternLayout"&amp;gt;&lt;br /&gt;  &amp;lt;conversionPattern value="%date ... %P{USER_IP} %P{REQUEST_URI} %P{USER_EMAIL} %P{USER_NAME} ..." /&amp;gt;&lt;br /&gt; &amp;lt;/layout&amp;gt;&lt;br /&gt;&amp;lt;/appender&amp;gt;&lt;br /&gt;&amp;lt;root&amp;gt;&lt;br /&gt; &amp;lt;level value="ALL" /&amp;gt;&lt;br /&gt; &amp;lt;appender-ref ref="PropertiesExpanderAppender" /&amp;gt;&lt;br /&gt;&amp;lt;/root&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Note the  &lt;span style="font-family: monospace;"&gt;&lt;/span&gt;%P{USER_IP} pattern elements, which correspond to the properties added by the forwarding appender.  Now you can add as many logging elements as you want, without having to add a bunch of classes.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33854586-115938279533232708?l=selectsoftwarethoughtsfromtyler.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/feeds/115938279533232708/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33854586&amp;postID=115938279533232708' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/115938279533232708'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/115938279533232708'/><link rel='alternate' type='text/html' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/2006/09/adding-custom-logging-properties-to.html' title='Adding Custom Logging Properties to your Log4Net configuration'/><author><name>gone_cat</name><uri>http://www.blogger.com/profile/02153508485029308717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://static.flickr.com/29/212753836_14f08c2c90_m.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33854586.post-115937980711007179</id><published>2006-09-27T10:42:00.000-07:00</published><updated>2006-09-27T10:56:47.120-07:00</updated><title type='text'>Getting your Log4Net AdoNetAppender running w/ Sql Server</title><content type='html'>After reading through Michael Flanakin's post, &lt;a href="http://geekswithblogs.net/flanakin/archive/2004/08/30/10418.aspx"&gt;Log4Net is Crap4Crap&lt;/a&gt;, and after some further hardship getting the AdoNetAppender to work, I have my own list of recommendations if you're trying to get it to work.&lt;br /&gt;&lt;br /&gt;1) Don't rely on log4net to give you feedback.  If anyone can explain this, please do.  I did set log4net.Util.LogLog.InternalDebugging = true, and still didn't get any help coming through my RollingLogFileAppender.  If you can help with this, please do, for posterity.&lt;br /&gt;&lt;br /&gt;2) Start a SQL Profiler and watch all login, failed login, and start command events.&lt;br /&gt;     Then you'll know whether the Appender is actually managing to execute the command and, if so, you'll get to have a look at what's wrong with it.&lt;br /&gt;&lt;br /&gt;3) Don't let your numeric values be set to null.  Log4net will die.  And be ready for null strings to actually be sent as the string value, "(null)".  This might only be an issue if you're using custom logging properties.&lt;br /&gt;&lt;br /&gt;4) Start simple.  I wound up succeeding by adding defaults to the parameters on my stored procedure, and then adding stored parameters one by one into the AdoNetAppender configuration.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33854586-115937980711007179?l=selectsoftwarethoughtsfromtyler.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/feeds/115937980711007179/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33854586&amp;postID=115937980711007179' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/115937980711007179'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/115937980711007179'/><link rel='alternate' type='text/html' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/2006/09/getting-your-log4net-adonetappender.html' title='Getting your Log4Net AdoNetAppender running w/ Sql Server'/><author><name>gone_cat</name><uri>http://www.blogger.com/profile/02153508485029308717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://static.flickr.com/29/212753836_14f08c2c90_m.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33854586.post-115886081233422163</id><published>2006-09-21T10:27:00.000-07:00</published><updated>2006-09-21T10:46:52.496-07:00</updated><title type='text'>HTTP ERROR: 400</title><content type='html'>Trying to get a self-signed SSL certificate installed on Windows Server 2003, sp1?  Good luck.  &lt;br /&gt;&lt;br /&gt;I spent a few hours trying to use selfcert.exe to install a certificate on an x64 machine, 2003 Server R2, sp1.  Every time I made a request to a URI other than the root, the response I got from the server was HTTP ERROR: 400.  Period.&lt;br /&gt;&lt;br /&gt;Here's what worked for me:&lt;br /&gt;&lt;br /&gt;1) Start-&gt;Programs-&gt;IIS Resources-&gt;SelfCert.exe.&lt;br /&gt;     type selfcert.exe to create a certificate on the default web server.&lt;br /&gt;&lt;br /&gt;2) Open MMC and add the Certificates snap-in.  Specify the Computer Account when asked which certificates to open.&lt;br /&gt;&lt;br /&gt;3) Find the newly created certicate under Personal, and export it to a pfx file.  Be sure to specify a password as windows won't let you import the certificate without entering something into the password field.&lt;br /&gt;&lt;br /&gt;4) On the Windows Server, Start-&gt;Run-&gt;Inetmgr to open Internet Services Manager.&lt;br /&gt;   under Directory Security on the web site properties, import the file from pfx.&lt;br /&gt;&lt;br /&gt;That worked!&lt;br /&gt;&lt;br /&gt;By the way, don't use CN=&lt;hostname of your server&gt; if you want SQL Server to continue working.  Use a different canonical name, such as the hostname of the site you're trying to protect.  See: http://support.microsoft.com/kb/302409/EN-US/ if you're using self-cert and suddenly you're getting SSL errors connecting to sql server.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33854586-115886081233422163?l=selectsoftwarethoughtsfromtyler.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/feeds/115886081233422163/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33854586&amp;postID=115886081233422163' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/115886081233422163'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/115886081233422163'/><link rel='alternate' type='text/html' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/2006/09/http-error-400.html' title='HTTP ERROR: 400'/><author><name>gone_cat</name><uri>http://www.blogger.com/profile/02153508485029308717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://static.flickr.com/29/212753836_14f08c2c90_m.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33854586.post-115873895420692159</id><published>2006-09-20T00:22:00.000-07:00</published><updated>2006-09-20T00:55:54.226-07:00</updated><title type='text'>Anatomy of a PowerShell script</title><content type='html'>if you do stuff, you should get PowerShell.  &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=2B0BBFCD-0797-4083-A817-5E6A054A85C9&amp;displaylang=en"&gt;Download it here.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I just spent a while learning some ins and outs of the scripting language, so let me try to spare you some trouble, and meanwhile talk about some of the sweet features of PowerShell scripts.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;#  The following starts the script and declares the parameters that it takes.&lt;br /&gt;#      From the command line you can query the script for its parameters,&lt;br /&gt;#      And this will also save you the trouble of coding in error messages when&lt;br /&gt;#      Args aren't provided.  The familiar $argv is also there in case you want to&lt;br /&gt;#      handle any number of parameters.&lt;br /&gt;Param([String]$server="localhost", [String]$database)&lt;br /&gt;&lt;br /&gt;#  Get-Item returns an object corresponding to a File System object.&lt;br /&gt;#      That in turn has all the properties that you'd hope for.&lt;br /&gt;$basedir = get-item($basedirectory)&lt;br /&gt;&lt;br /&gt;#  Note that the argument to UseTheseUpgradeDirs is a call to dir, the familiar&lt;br /&gt;#      directory listing command.  It's actually an alias for the scriptlet&lt;br /&gt;#      get-childitem, which returns a collection of child objects, this time&lt;br /&gt;#      of the "Upgrade Scripts" directory.&lt;br /&gt;$upgradeDirs = UseTheseUpgradeDirs(dir "Upgrade Scripts")&lt;br /&gt;&lt;br /&gt;#  A simple loop.  Note the syntax for calling static members on a class.&lt;br /&gt;foreach ($dir in $upgradeDirs)&lt;br /&gt;{&lt;br /&gt; RunScriptsIn($dir, [DateTime]::MinValue)&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#  Here's a function declaration, with the parameter declaration below.&lt;br /&gt;#       push-location can also be referred to as pushd.  Any scriptlet can be aliased&lt;br /&gt;#       Just see the user manual.&lt;br /&gt;#       Note the ease in filtering, where I set $files equal to the collection of&lt;br /&gt;#       File System objects named as such, with LastWriteTime greater than something.&lt;br /&gt;function RunScriptsIn&lt;br /&gt;{&lt;br /&gt; Param([String]$dir, [DateTime]$modifiedAfter)&lt;br /&gt; push-location($dir)&lt;br /&gt; $files = dir *.sql, *.prc, *.viw, *.udf | '&lt;br /&gt;               where {$_.LastWriteTime -gt $modifiedAfter}&lt;br /&gt;&lt;br /&gt;#  write-host is like ECHO in batch language.&lt;br /&gt;#      $null is the null value.  Note the strange binary operator ('=' is always&lt;br /&gt;#      an assignment operator here.  Get used to -lt, -gt, -not, etc.  Why? I don't&lt;br /&gt;#      know, but this script sure was easy to include in an html page.&lt;br /&gt;if ($files -eq $null) {&lt;br /&gt; write-host No new database changes in $dir&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;#   Note the ease in shelling out to OSQL.EXE.  Just like a true shell language.&lt;br /&gt;foreach($file in $files)&lt;br /&gt;{&lt;br /&gt; write-host $file.name&lt;br /&gt; $results = osql -n -S $server -U $user -P $password -d $database -i $file.name&lt;br /&gt; write-host $results&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#  Then there's the .Net Framework support.  See my earlier post for an example.&lt;br /&gt;&lt;/pre&gt;Next, if you want to run powershell scripts at all you have to relax the system&lt;br /&gt;Security just a bit. Then you need to create certificates for yourself and start signing.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;#  This command will give you an article answering questions about signing.&lt;br /&gt;#      I'll give you the quick and easy though.&lt;br /&gt;get-help about_signing&lt;br /&gt;&lt;br /&gt;#  The following command will tell your system to run scripts that have been&lt;br /&gt;#      Digitally signed so that you know who wrote them.  If you feel pretty certain&lt;br /&gt;#      That I wrote and signed a script that you have, you can tell your system to&lt;br /&gt;#      Trust me as a code publisher, and subsequent scripts from me will be&lt;br /&gt;#      Recognized as safe.&lt;br /&gt;Set-ExecutionPolicy AllSigned&lt;br /&gt;&lt;br /&gt;#  The following two commands will set up certificates for PowerShell and you.&lt;br /&gt;#      Don't forget to set your name under CN.  You must run the makecert.exe&lt;br /&gt;#      That comes with .Net Framework 2.0 SDK.&lt;br /&gt;    makecert -n "CN=PowerShell Local Certificate Root" -a sha1 `&lt;br /&gt;        -eku 1.3.6.1.5.5.7.3.3 -r -sv root.pvk root.cer `&lt;br /&gt;        -ss Root -sr localMachine&lt;br /&gt;    makecert -pe -n "CN=Jane Programmer" -ss MY -a sha1 `&lt;br /&gt;        -eku 1.3.6.1.5.5.7.3.3 -iv root.pvk -ic root.cer&lt;br /&gt;&lt;br /&gt;#  Now sign your first script, a script that will sign future scripts!&lt;br /&gt;#     The following is the content of the script.&lt;br /&gt;#     In order to sign it, create the text file, then enter PowerShell interactive&lt;br /&gt;#     Shell, set the $file variable yourself, and then run lines 2 and 3 in the &lt;br /&gt;#     shell.&lt;br /&gt;param([string] $file=$(throw "Please specify a filename."))&lt;br /&gt;$cert = @(Get-ChildItem cert:\CurrentUser\My -codesigning)[0]&lt;br /&gt;Set-AuthenticodeSignature $file $cert&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;There's a very nice tutorial of PowerShell &lt;a href="http://arstechnica.com/guides/other/msh.ars/1"&gt;Right here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33854586-115873895420692159?l=selectsoftwarethoughtsfromtyler.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/feeds/115873895420692159/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33854586&amp;postID=115873895420692159' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/115873895420692159'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/115873895420692159'/><link rel='alternate' type='text/html' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/2006/09/anatomy-of-powershell-script.html' title='Anatomy of a PowerShell script'/><author><name>gone_cat</name><uri>http://www.blogger.com/profile/02153508485029308717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://static.flickr.com/29/212753836_14f08c2c90_m.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33854586.post-115862454892926441</id><published>2006-09-18T17:03:00.000-07:00</published><updated>2006-09-18T17:13:21.996-07:00</updated><title type='text'>A real command shell from Microsoft</title><content type='html'>I wish I'd have known about &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=2B0BBFCD-0797-4083-A817-5E6A054A85C9&amp;displaylang=en"&gt;PowerShell &lt;/a&gt;a while ago.  I had long given up on this and turned to cygwin, dreamed about carving out enough spare time to augment IronPython to have a handy windows scripting api.&lt;br /&gt;&lt;br /&gt;Anyhow, it's a little awkward but I think I like it.  Better to show than tell, here's a script that does a little communication with SQL Server via osql.exe and the SqlClient api:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;function main&lt;br /&gt;{&lt;br /&gt; $basedir = "D:\prj"&lt;br /&gt;&lt;br /&gt; push-location($basedir)&lt;br /&gt;&lt;br /&gt; $upgradeDirs = UseTheseUpgradeDirs(dir "Upgrade Scripts")&lt;br /&gt;&lt;br /&gt; push-location("Upgrade Scripts")&lt;br /&gt; foreach ($dir in $upgradeDirs)&lt;br /&gt; {&lt;br /&gt;  RunScriptsIn($dir)&lt;br /&gt; }&lt;br /&gt; pop-location&lt;br /&gt; &lt;br /&gt; RunScriptsIn('Views')&lt;br /&gt; RunScriptsIn('Functions')&lt;br /&gt; RunScriptsIn('Stored Procedures')&lt;br /&gt; &lt;br /&gt; pop-location&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;function RunScriptsIn($dir)&lt;br /&gt;{&lt;br /&gt; push-location($dir)&lt;br /&gt; $files = dir *.sql, *.prc, *.viw, *.udf&lt;br /&gt; foreach($file in $files)&lt;br /&gt; {&lt;br /&gt;  write-host $file.name&lt;br /&gt;  $results = osql -n -S localhost -E -i "$file"&lt;br /&gt;  write-host $results&lt;br /&gt; }&lt;br /&gt; pop-location&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;function UseTheseUpgradeDirs( $dirs )&lt;br /&gt;{&lt;br /&gt; $useThese = new-object System.Collections.ArrayList&lt;br /&gt; &lt;br /&gt; $conn = new-object System.data.SqlClient.SqlConnection(&lt;br /&gt;  [String]::Format("Server={0};Database={1};User={2};Password={3};",&lt;br /&gt;    $server, $database, $user, $password))&lt;br /&gt;    &lt;br /&gt; $conn.open()&lt;br /&gt; &lt;br /&gt; foreach($dir in $dirs)&lt;br /&gt; {&lt;br /&gt;  $sql = &lt;br /&gt;   "select count(1) from version where build &gt;= '" + $dir.name.SubString(5) + "'"&lt;br /&gt;  $cmd = new-object System.Data.SqlClient.SqlCommand($sql, $conn)&lt;br /&gt;  $reader = $cmd.ExecuteReader()&lt;br /&gt;  $foobar = $reader.Read()&lt;br /&gt;  if ($reader[0]&gt;=1)&lt;br /&gt;  {&lt;br /&gt;   $useThese.Add($dir)&lt;br /&gt;  }&lt;br /&gt;  $reader.close()&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; $conn.close()&lt;br /&gt; return($useThese)&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;main&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33854586-115862454892926441?l=selectsoftwarethoughtsfromtyler.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/feeds/115862454892926441/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33854586&amp;postID=115862454892926441' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/115862454892926441'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/115862454892926441'/><link rel='alternate' type='text/html' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/2006/09/real-command-shell-from-microsoft.html' title='A real command shell from Microsoft'/><author><name>gone_cat</name><uri>http://www.blogger.com/profile/02153508485029308717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://static.flickr.com/29/212753836_14f08c2c90_m.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33854586.post-115774378607417607</id><published>2006-09-08T12:29:00.000-07:00</published><updated>2006-09-08T12:29:57.490-07:00</updated><title type='text'>Amy Goodman speaking in Northern California</title><content type='html'>Amy Goodman, who has been called a National Treasure by Michael Moore, is touring the US with her new book.  Coming through northern california, she'll speak in Oakland, Santa Cruz and Sebastopol.&lt;br /&gt;&lt;br /&gt;Amy is most noteworthy for her presence as the host of &lt;a href="http://democracynow.org"&gt;DemocracyNow!&lt;/a&gt;, a newswire that has been broadcasting independent news since 1996.&lt;br /&gt;&lt;br /&gt;for more info see &lt;a href="http://tour.democracynow.org/2006/09/santa_cruz_ca.html"&gt;http://tour.democracynow.org/2006/09/santa_cruz_ca.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;WHERE:Veterans Hall, 282 S. High St., Sebastopol, CA&lt;br /&gt;WHEN: Sun 9/17/06 @ 10 AM&lt;br /&gt;DESCRIPTION: A benefit for KRCB with Amy Goodman and David Goodman, co-sponsored by Copperfield's Books.&lt;br /&gt;TICKETS:$10 at the door, $5 for KRCB members&lt;br /&gt;MORE INFO:http://krcb.org/amy_goodman.htm&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33854586-115774378607417607?l=selectsoftwarethoughtsfromtyler.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/feeds/115774378607417607/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33854586&amp;postID=115774378607417607' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/115774378607417607'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/115774378607417607'/><link rel='alternate' type='text/html' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/2006/09/amy-goodman-speaking-in-northern.html' title='Amy Goodman speaking in Northern California'/><author><name>gone_cat</name><uri>http://www.blogger.com/profile/02153508485029308717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://static.flickr.com/29/212753836_14f08c2c90_m.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33854586.post-115767650053997913</id><published>2006-09-07T17:45:00.000-07:00</published><updated>2006-09-07T17:48:20.546-07:00</updated><title type='text'>pyWin</title><content type='html'>Microsoft have released a .Net implementation of the Python programming language, complete with an interactive shell.  Good move, Microsoft.&lt;br /&gt;&lt;a href="http://www.codeplex.com/Wiki/View.aspx?ProjectName=IronPython"&gt;Get it here.&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33854586-115767650053997913?l=selectsoftwarethoughtsfromtyler.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/feeds/115767650053997913/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33854586&amp;postID=115767650053997913' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/115767650053997913'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/115767650053997913'/><link rel='alternate' type='text/html' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/2006/09/pywin.html' title='pyWin'/><author><name>gone_cat</name><uri>http://www.blogger.com/profile/02153508485029308717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://static.flickr.com/29/212753836_14f08c2c90_m.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33854586.post-115767374413473857</id><published>2006-09-07T17:00:00.000-07:00</published><updated>2006-09-07T17:02:24.143-07:00</updated><title type='text'>Mozart On Wheels</title><content type='html'>You'll want to check this out (it's only 43 seconds long): &lt;a href="http://youtube.com/watch?v=ZpgKr3Ruqnw"&gt;The most rockin' rollerblader I ever did see.&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33854586-115767374413473857?l=selectsoftwarethoughtsfromtyler.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/feeds/115767374413473857/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33854586&amp;postID=115767374413473857' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/115767374413473857'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/115767374413473857'/><link rel='alternate' type='text/html' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/2006/09/mozart-on-wheels.html' title='Mozart On Wheels'/><author><name>gone_cat</name><uri>http://www.blogger.com/profile/02153508485029308717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://static.flickr.com/29/212753836_14f08c2c90_m.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33854586.post-115760308212530243</id><published>2006-09-06T21:21:00.000-07:00</published><updated>2006-09-06T21:36:52.633-07:00</updated><title type='text'>Ruthless Database Administration</title><content type='html'>I like to keep a special database on my server, called 'admin', wherein I store nasty little procedures like this one.  So, you thought you were going to restore the database from backup, but after waiting about 30 seconds the server complains that there are users in the database.&lt;br /&gt;&lt;br /&gt;If you're trying to restore the database from backup, who cares if you ruin a query that was in progress?  Get them out of there!  The following sproc will kill all processes running in the specified database, except for the current process.  No questions asked.&lt;br /&gt;&lt;br /&gt;&lt;style type="text/css"&gt;&lt;br /&gt;.cf { font-family: Courier New; font-size: 10pt; color: black; background: white; border-top: windowtext 1pt solid; padding-top: 0pt; border-left: windowtext 1pt solid; padding-left: 0pt; border-right: windowtext 1pt solid; padding-right: 0pt; border-bottom: windowtext 1pt solid; padding-bottom: 0pt; }&lt;br /&gt;.cl { margin: 0px; }&lt;br /&gt;.cb1 { color: blue; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;USE [admin]&lt;br /&gt;&lt;br /&gt;GO&lt;br /&gt;&lt;div class="cf"&gt; &lt;/div&gt;&lt;div class="cf"&gt;/*************************************************************&lt;/div&gt;&lt;div class="cf"&gt; *&lt;br /&gt; *  sproc: kill_processes&lt;br /&gt; *  author: &lt;a href="mailto:tgannon@gmail.com"&gt;tgannon@gmail.com&lt;/a&gt;&lt;br /&gt; *  This code is provided as is, and the author is not responsible for data damaged or lost&lt;/div&gt;&lt;div class="cf"&gt; *      through its use.&lt;/div&gt;&lt;div class="cf"&gt; *&lt;/div&gt;&lt;div class="cf"&gt; *************************************************************/&lt;br /&gt;&lt;span class="cb1"&gt;ALTER PROCEDURE &lt;/span&gt;dbo.kill_processes (@database_name &lt;span class="cb1"&gt;SYSNAME&lt;/span&gt;)&lt;br /&gt;&lt;span class="cb1"&gt;AS&lt;/span&gt;&lt;br /&gt;&lt;span class="cb1"&gt;DECLARE &lt;/span&gt;test_cursor &lt;span class="cb1"&gt;CURSOR&lt;/span&gt;&lt;br /&gt;READ_ONLY&lt;br /&gt;&lt;span class="cb1"&gt;FOR &lt;/span&gt;&lt;br /&gt;    &lt;span class="cb1"&gt;select &lt;/span&gt;spid &lt;span class="cb1"&gt;from &lt;/span&gt;master..sysprocesses p &lt;span class="cb1"&gt;inner join &lt;/span&gt;master..sysdatabases d&lt;br /&gt;    &lt;span class="cb1"&gt;on &lt;/span&gt;p.dbid = d.dbid&lt;br /&gt;    &lt;span class="cb1"&gt;where name&lt;/span&gt;=@database_name&lt;br /&gt; &lt;br /&gt;&lt;span class="cb1"&gt;DECLARE &lt;/span&gt;@spid &lt;span class="cb1"&gt;int&lt;/span&gt;, @cmd &lt;span class="cb1"&gt;varchar&lt;/span&gt;(50)&lt;br /&gt;&lt;span class="cb1"&gt;OPEN &lt;/span&gt;test_cursor&lt;br /&gt; &lt;br /&gt;&lt;span class="cb1"&gt;FETCH NEXT FROM &lt;/span&gt;test_cursor &lt;span class="cb1"&gt;INTO &lt;/span&gt;@spid&lt;br /&gt;&lt;span class="cb1"&gt;WHILE &lt;/span&gt;(@@fetch_status &amp;lt;&amp;gt; -1)&lt;br /&gt;&lt;span class="cb1"&gt;BEGIN&lt;/span&gt;&lt;br /&gt;    &lt;span class="cb1"&gt;IF &lt;/span&gt;(@@fetch_status &amp;lt;&amp;gt; -2)&lt;br /&gt;    &lt;span class="cb1"&gt;BEGIN&lt;/span&gt;&lt;br /&gt;        &lt;span class="cb1"&gt;IF &lt;/span&gt;@spid &amp;lt;&amp;gt; @@spid&lt;br /&gt;        &lt;span class="cb1"&gt;BEGIN&lt;/span&gt;&lt;br /&gt;            &lt;span class="cb1"&gt;PRINT &lt;/span&gt;'Killing process ' + &lt;span class="cb1"&gt;CONVERT&lt;/span&gt;(&lt;span class="cb1"&gt;VARCHAR&lt;/span&gt;, @spid) + '.'&lt;br /&gt;            &lt;span class="cb1"&gt;SELECT &lt;/span&gt;@cmd = 'KILL ' + &lt;span class="cb1"&gt;CONVERT&lt;/span&gt;(&lt;span class="cb1"&gt;VARCHAR&lt;/span&gt;, @spid)&lt;br /&gt;            &lt;span class="cb1"&gt;EXEC &lt;/span&gt;(@cmd)&lt;br /&gt;        &lt;span class="cb1"&gt;END&lt;/span&gt;&lt;br /&gt;    &lt;span class="cb1"&gt;END&lt;/span&gt;&lt;br /&gt;    &lt;span class="cb1"&gt;FETCH NEXT FROM &lt;/span&gt;test_cursor &lt;span class="cb1"&gt;INTO &lt;/span&gt;@spid&lt;br /&gt;&lt;span class="cb1"&gt;END&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;span class="cb1"&gt;CLOSE &lt;/span&gt;test_cursor&lt;br /&gt;&lt;span class="cb1"&gt;DEALLOCATE &lt;/span&gt;test_cursor &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33854586-115760308212530243?l=selectsoftwarethoughtsfromtyler.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/feeds/115760308212530243/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33854586&amp;postID=115760308212530243' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/115760308212530243'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/115760308212530243'/><link rel='alternate' type='text/html' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/2006/09/ruthless-database-administration.html' title='Ruthless Database Administration'/><author><name>gone_cat</name><uri>http://www.blogger.com/profile/02153508485029308717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://static.flickr.com/29/212753836_14f08c2c90_m.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33854586.post-115750126202482865</id><published>2006-09-05T17:02:00.000-07:00</published><updated>2006-09-05T17:07:42.033-07:00</updated><title type='text'>Regex Workbench, worth getting</title><content type='html'>Get Eric Gunnerson's Regular Expressions Workbench &lt;a href="http://blogs.msdn.com/ericgu/archive/2003/07/07/52362.aspx"&gt;Here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;This is an excellent piece of software for developers.  So handy for use in writing regular expressions, that for me it sometimes predicates a decision to go ahead and write a robust expression, rather than a quick and easy set of string comparisons.  The latter work but require more code and frequently lead to a reduced set of expressions that the software will handle.&lt;br /&gt;&lt;br /&gt;Thanks, Eric.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33854586-115750126202482865?l=selectsoftwarethoughtsfromtyler.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/feeds/115750126202482865/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33854586&amp;postID=115750126202482865' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/115750126202482865'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/115750126202482865'/><link rel='alternate' type='text/html' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/2006/09/regex-workbench-worth-getting.html' title='Regex Workbench, worth getting'/><author><name>gone_cat</name><uri>http://www.blogger.com/profile/02153508485029308717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://static.flickr.com/29/212753836_14f08c2c90_m.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33854586.post-115740004389422059</id><published>2006-09-04T12:56:00.000-07:00</published><updated>2006-09-04T13:00:43.906-07:00</updated><title type='text'>IE7 Doesn't Suck</title><content type='html'>&lt;a href="http://www.microsoft.com/windows/ie/downloads/default.mspx"&gt;Download Internet Explorer 7&lt;/a&gt;.  It doesn't suck.  I don't know whether Microsoft have fixed the security problems that lead to the popularization of &lt;a href="http://www.mozilla.com/firefox/"&gt;A truly excellent browser&lt;/a&gt;, but the new features include tabbed browsing and IMO the most well-designed Full Screen feature to date.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33854586-115740004389422059?l=selectsoftwarethoughtsfromtyler.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/feeds/115740004389422059/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33854586&amp;postID=115740004389422059' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/115740004389422059'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/115740004389422059'/><link rel='alternate' type='text/html' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/2006/09/ie7-doesnt-suck.html' title='IE7 Doesn&apos;t Suck'/><author><name>gone_cat</name><uri>http://www.blogger.com/profile/02153508485029308717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://static.flickr.com/29/212753836_14f08c2c90_m.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-33854586.post-115739707130381806</id><published>2006-09-04T12:04:00.000-07:00</published><updated>2006-09-04T12:11:11.313-07:00</updated><title type='text'>Trying out SQL Server 2005</title><content type='html'>SQL Server 2005 Express Edition comes with almost everything you need to do development work.  The lack of a Profiler tool is going to have me purchasing the developer edition very soon, but download the free management tools from &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=C243A5AE-4BD1-4E3D-94B8-5A0F62BF7796&amp;displaylang=en"&gt;Microsoft's Download Site&lt;/a&gt;, and find everything else you'd hoped would carry over from SQL Server 2000 Enterprise Manager.&lt;br /&gt;&lt;br /&gt;Also, check out &lt;a href="http://www.red-gate.com/products/SQL_Prompt/index.htm"&gt;Red Gate's SQLPrompt&lt;/a&gt;.  It plugs into your Query Analyzer and offers object name and keyword completion a via familiar CTRL-Space-induced drop-down list.  It's clumsy at first but helpful if you have too many objects in your database to remember all the names.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/33854586-115739707130381806?l=selectsoftwarethoughtsfromtyler.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/feeds/115739707130381806/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=33854586&amp;postID=115739707130381806' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/115739707130381806'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/33854586/posts/default/115739707130381806'/><link rel='alternate' type='text/html' href='http://selectsoftwarethoughtsfromtyler.blogspot.com/2006/09/trying-out-sql-server-2005.html' title='Trying out SQL Server 2005'/><author><name>gone_cat</name><uri>http://www.blogger.com/profile/02153508485029308717</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='29' height='32' src='http://static.flickr.com/29/212753836_14f08c2c90_m.jpg'/></author><thr:total>0</thr:total></entry></feed>
