microsoft

SQL Server and OLE DB

I just ran into a less-than-documented issue with OLE DB and SQL Server 2008 64 bit Enterprise. The particular error message was:

OLE DB provider 'HP3KProvider' for linked server 'HP3000' returned data that does not match expected data length for column '[HP3KProvider].sid'. The (maximum) expected data length is 28, while the returned data length
is 18.

So what if the data is smaller than what was expected? Well, SQL Server cares and errors out. To get it to stop doing this, a trace flag is needed.

You can now watch the inauguration using Linux and Silverlight

You can now use the Firefox plugin at http://www.go-mono.com/moonlight and the link at http://www.pic2009.org/page/content/live to stream the inauguration. This plugin was created in part by Microsoft engineers volunteering for the mono project.

Microsoft, Windows 7, and Linux

I read an article on Slashdot detailing an announcement by Microsoft. This announcement states that Windows XP will be available to OEMs, or computer system builders, until May 2009.

Vista was supposed to replace Windows XP on new computers in January of this year. However, sales of Windows Vista and a public outcry persuaded the company to extend the sales of OEM copies of Windows XP through 2010.

Rant from Bill Gates

"Then it told me to reboot my machine. Why should I do that? I reboot every night -- why should I reboot at that time?

So I did the reboot because it INSISTED on it. Of course that meant completely getting rid of all my Outlook state."

--Email from Bill Gates regarding Windows Usability 2003

Full text of email can be viewed at the Seattle PI's website.

AWStats On IIS 6.0

After setting up AWStats On IIS, I wanted to use awstats.pl instead of the static pages. I configured it according to what I found on the internet, but there was a problem. I would go to the awstats.pl and I would get the html on the page rather than the rendered html. I found the problem, but it requires editing awstats.pl.

On line 550, there is a function called http_head. In line 553, the following line:

else { print "Content-type: text/html; charset=$PageCode\n"; }

should be changed to:

else { print "HTTP/1.0 200 OK Content-type: text/html"}

Vista, IE 7 And Secure Certificates

I ran into a strange problem at work today. We have a web server on which is installed a self-generated SSL certificate. This page has worked fine as far as I know for several years. The certificate, however, was not generated for the URL and is therefore not valid. This is something we were going to get around to fix, but it looks like we'll have to do it sooner than later.

Normally, in Windows XP with Internet Explorer 7 and 6, Firefox on Windows and Linux and many other browsers and platforms I assume, a prompt is shown to the user asking if they want to connect to the website anyway.

MS SQL: Insert Multiple Rows With One Query

Just figured this out. Using Microsoft SQl Server 2000, you can insert multiple rows into a table with one query as in the following examples:

Single Column:

CREATE TABLE test
(
val1 INTEGER NOT NULL
)

INSERT INTO test
SELECT 62
UNION
SELECT 91
UNION
SELECT 95
UNION
SELECT 98
UNION
SELECT 99

This will insert 5 rows into the table. To do multiple columns, use the following:

CREATE TABLE test
(
val1 VARCHAR(10),
val2 VARCHAR(10),
val3 VARCHAR(10),
val4 VARCHAR(10)
)
GO

INSERT INTO test
(val1, val2, val3, val4)

MS SQL: Using A Case Statement In A View

Here is a neat trick for using conditional processing in a view.

I needed to create a view that contained an employee id and employee name amongst other data. The original view included two joins, but for the sake of simplicity, I have altered the view. This view uses a case statement to determine which "full name" to show, the full name using the first name or the full name using the nickname if the employee has one.

SQL: Totaling A Column Containing Varying Values

I have been doing quite a few surveys recently and one of the tasks involved is mining the responses for data. Here's a neat trick I learned for totalling and counting responses using sql rather than programmatically on the front end.

Let's say you have a table of customers (tblCustomers) that houses the name of each person and the flavor of ice cream each customer prefers: