Thursday, November 17, 2005

Avoiding Divide by Zero within SQL...

SELECT
myval =
case
when [denominator calculation] IN (0, NULL) then 0
else [full calculation]
end
FROM [table]


Original link here

Thursday, November 03, 2005

Code sample: How to run a Sql Server DTS Job from VB .Net


Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ExecuteDTS("sqlserver", "nameofDTSJob", , )

End Sub
'Reference Microsoft DTSPackage Object Library
Public Sub ExecuteDTS(ByVal sServer As String, ByVal sPackage As String, _
Optional ByVal sUser As String = vbNullString, _
Optional ByVal sPassword As String = vbNullString)

Dim oPackage As DTS.Package2 'The DTS Package Object

' Initialize DTS Package
oPackage = New DTS.Package2

' Run DTS Package
' LoadFromSQLServer can be replaced with LoadFromRepository or
' LoadFromStorageFile depending on the storage location of the package
oPackage.LoadFromSQLServer(sServer, sUser, sPassword, _
DTS.DTSSQLServerStorageFlags.DTSSQLStgFlag_UseTrustedConnection, , , , sPackage)
oPackage.Execute()

' Cleanup
oPackage = Nothing
End Sub

End Class

Wednesday, October 26, 2005

Turn off hidden menus on XP

Hidden menu items are a complete annoyance!! Here's how to turn them back on:

http://www.annoyances.org/exec/show/article03-100

Thursday, October 06, 2005

This simple change will keep Windows 2000 from hiding unused start menu items



Tip #65: Stop Personalized Menus

In the Windows 2000 Start Menu, only the most recently used applications are displayed, with the rest being hidden until you hold the mouse over the little double-arrows (much like in Office 2000). To rid your system of this somewhat annoying behavour, click Start | Settings | Task Bar & Start Menu. For Windows 2000, look on the General tab. For Windows XP, click the Start Menu Tab, then Click Customize. Then uncheck the "Use Personalized Menus" box on the General tab, then click OK. Now the entire contents of the Start menu will be displayed.

Thursday, September 22, 2005

How to Change the default font in Word

How to Change the default font in Word.



File/Open
Navigate to the c:\documents and settings\user name\application settings\microsoft\templates

Open the normal.dot
Change the style: Format/Styles and formatting
Right click on the Normal setting and change the font.

Save the document and exit.

Phone Format Sql Reporting Services

Here is how to format a phone number in Sql Reporting Services:

call the function below with this in an expression box: =code.CustomFormat( Fields!ContactNumber.Value)

Put this in the Custom Code dialog box:


Public Function CustomFormat(ByVal Value As String) As String

Dim FormatPhone As String
FormatPhone = Trim(Value)
IF FormatPhone <> VBNullString Then

Select Case FormatPhone.Length
Case 7
FormatPhone = FormatPhone.Insert(3, "-" )
Case 10
FormatPhone = FormatPhone.Insert(3, "-" )
FormatPhone = FormatPhone.Insert(7, "-" )
Case 12
FormatPhone = FormatPhone.Insert(3, "-" )
FormatPhone = FormatPhone.Insert(7, "-" )
Case Else
FormatPhone = ""
End Select
End If

Return FormatPhone

End Function


Thanks to the post here: http://www.sqlreportingservices.net/Ask/3647.aspx

Friday, September 02, 2005

SQL Reporting Services Service Pack 2 - Failure modifying security permissions on file C:\Program Files\...\RSTempFiles

There is nothing out there for this error, except this Italian link:

Errore durante l'installazione di Reporting Services SP2 (ma vale anche per l'SP1): "Failure modifying security permissions on file C:\Program Files\...\RSTempFiles"

Thanks to this guy's link, I figured out you need to change the ReportingService logon to a System account.

Thursday, August 25, 2005

Wednesday, August 24, 2005

SQL Error Msg 170, Level 15

Need to set "SET QUOTED_IDENTIFIER ON"
when " are used in a query.

http://lists.ibiblio.org/pipermail/freetds/2004q2/015807.html
a

Monday, August 22, 2005

Spooler error event id: 7031

Problem: The printer spooler on Windows 2000 server is stopping itself, creating error: Spooler error event id: 7031

Resolution: There were some strange printers showing up in the registry entry below. I deleted them and it fixed the problem.

http://www.windowsbbs.com/showthread.php?t=37799



You may want to check the following registry key for any printers that should not be installed.
HKLM\System\CurrentControlSet\Control\Print\Printe rs
(I have no idea why a space character is appearing in the word "Printers"!)

I had a very similar issue (except this was on a Citrix Metaframe server) and it turns out that there was a print device listed there which was autocreated from a client printer and never purged. I think there was something invalid in that registry entry because as soon as I deleted it, the spooler service worked fine.

Good Luck.
-Dman33

Friday, June 03, 2005

How to: Sql reporting services create subtotals for a matrix

Welcome to the MSDN Library: "Sorting
You can sort data within a matrix by any expression. To view instructions about sorting, click the following topic:
How to add sorting to a matrix (Report Designer)


Adding Subtotals

To add a subtotal to a matrix, add a subtotal to an individual group within the matrix. Groups do not have subtotals by default. To add a subtotal to a group, right-click the group column or row header and then click Subtotal. This will open a new header for the subtotal. Reporting Services will calculate the subtotal based on the aggregate in the data cell for the group.
For information about aggregate functions, see Aggregate Functions.
Displaying Data on Either Side of Row Headers
You are not limited to displaying row headers on the side of the matrix. You can move the row headers inward, so that columns of data appear before the row headers. To do this, modify the GroupsBeforeRowHeaders property for the matrix. You can access this property through the Properties window or the General tab of the Matrix Properties dialog box. The value for this property is an integer; a value of 2 will display two groups of matrix data before displaying the column containing the row headers."

Thursday, May 26, 2005

Remote Desktop Connection error: "you do not have access to log on to this session"

Remote Administration of Terminal Services by Non-Administrators Accounts

1. Click Start, point to Programs, point to Administrative Tools, and then click Terminal Services Configuration.
2. in the tree in the left pane, click Connections.
3. Click the RDP-TCP connection in the right pane, and then click Properties on the Action menu.
4. Click the Permissions tab.

NOTE: Only Administrator and System accounts appear.
5. Click Add. Search for the groups or users that are appropriate for your Terminal Services management (such as the Server Operators group). Click Add to place them in the bottom pane. Click OK.

NOTE: The Server Operators group appears in the RDP-TCP properties; the permissions in the bottom pane are not enough to manage the server because only Guest Access is selected by default.
6. Click to select the User Access check box for basic tasks or both the User Access and Full Control check boxes to fully manage the server, and then click Apply.
7. Click OK.
8. Test by logging on the accounts in the Server Operators group.

Friday, May 20, 2005

Apostate Caf� VB format() function - formatting symbols

Apostate Caf� VB format() function: "r"

SQL Server Reporting services Phone Format function

Phone Format: "'Returns formatted Phone Number
Public Function CustomFormat(ByVal Value As String) As String
Dim FormatPhone As String
FormatPhone = Value
Select Case Value.Length
Case 7
FormatPhone = Value.Substring(0, 3) & '-' & Value.Substring(3, 4)
Case 10
FormatPhone = '(' & (Value.Substring(0, 3) & ') ' & Value.Substring(3, 3) & '-' & Value.Substring(6, 4))
Case 12
FormatPhone = ('(' & Value.Substring(0, 3) & ') ' & Value.Substring(4, 3) & '-' & Value.Substring(8, 4))
End Select
Return FormatPhone
End Function"

Custom Numeric Format Strings - Phone number format

Custom Numeric Format Strings: "myDouble.ToString( '(###) ### - ####' )"

Monday, April 11, 2005

Good example of vbscript window.open syntax

Web Page Programming: ActiveX and VBScript: "you rarely have to mention the Window object directly. For example, the statements Window.name and name are equivalent. This section examines some common "

Good example of vbscript window.open syntax

Wednesday, March 23, 2005

Page Hijack Exploit: 302, redirects and Google

Page Hijack Exploit: 302, redirects and Google: "racked this and related problems with the search engines literally for years. If there was something that you could easily do to fix it as a webmaster, I would have published it a long time ago. That said; the points listed below will most likely make your pages harder to hijack. I will and can not promise immunity, though, and I specifically don't want to spread false hopes by promising that these will help you once a hijack has already taken place. On the other hand, once hijacked you will lose nothing by trying them.
Always redirect your 'non-www' domain (example.com) to the www version (www.example.com) - or the other way round (I personally prefer non-www domains, but that's just because it appeals to my personal sense of convenience). The direction is not important. It is important that you do it with a 301 redirect and not a 302, as the 302 is the one leading to duplicate pages. If you use the Apache web server, the way to do this is to insert the following in your root '.htaccess' file:"

Tuesday, March 08, 2005

sqlclient.sqlexception incorrect syntax parameter near ?

the sqlclient does not accept '?' as a parameter, you must use '@' instead.

Wednesday, March 02, 2005

ABC News: Getting Sick on an Ocean Cruise

ABC News: Getting Sick on an Ocean Cruise: "Margolin, a leading microbiologist and viral expert at the University of New Hampshire who consults for the government, told ABC News he thinks such stains are not uncommon on cruise ships or in hotels and motels. 'I think what's new is that we have new ways of detecting it so that we now know that it really exists,' he said. "

Monday, February 28, 2005

Server Application Unavailable

Server Application Unavailable
The web application you are attempting to access on this web server is currently unavailable. Please hit the "Refresh" button in your web browser to retry your request.
Administrator Note: An error message detailing the cause of this specific request failure can be found in the application event log of the web server. Please review this log entry to discover what caused this error to occur.


I had to uninstall VS 2005 Beta before it would work again.

Monday, February 21, 2005

Microsoft Office Assistance: ASCII character chart

Microsoft Office Assistance: ASCII character chart

Remove unwanted line breaks from data

Remove unwanted line breaks from data: "Sub CarriageBegone()
Dim rng As Range
For Each rng In Selection
rng.Replace vbLf, ', '
rng.Replace vbCr, ', '
Next rng
Set rng = Nothing
End Sub "

Tuesday, February 01, 2005


farm Posted by Hello

VNC disable tray icon

ImageShack� - Hosting: "Thanks to ImageShack for [URL=http://www.imageshack.us]Free Image Hosting[/URL]"

Change default Word font

Change the Normal template (Normal.dot)

The Normal template (Normal template: A global template that you can use for any type of document. You can modify this template to change the default document formatting or content.) opens whenever you start Word, and it includes default styles, AutoText, macros, toolbars, and other customizations that determine the basic look of your document.

On the File menu, click Open, and then navigate to

C:\Documents and Settings\user name\Application Data\Microsoft\Templates.
If no templates are listed in the Open dialog box, click the arrow next to the Files of type box, and then click Document Templates.

Double-click the Normal.dot file to open it. To be certain that you're working in the default template, check to see that Normal.dot appears in the Word title bar.
Make any changes you want, using the menus and dialog boxes just as you would to change default settings for a document, but remember that any changes you make to Normal.dot will be applied to documents that you create in the future.
When you have finished, on the Standard toolbar (toolbar: A bar with buttons and options that you use to carry out commands. To display a toolbar, click Customize on the Tools menu, and then click the Toolbars tab.), click Save .
Note If Normal.dot is renamed, damaged, or moved, Word automatically creates a new version (which uses the original default settings) the next time that you start Word. The new version will not include any customizations you made to the version that you renamed or moved.

Thursday, January 20, 2005

Working with SQL Server Date/Time Variables: Part Two - Displaying Dates and Times in Different Formats

http://www.databasejournal.com/features/mssql/article.php/2197931


Working with SQL Server Date/Time Variables: Part Two - Displaying Dates and Times in Different Formats: "PRINT '1) HERE IS MON DD YYYY HH:MIAM (OR PM) FORMAT ==>' +
CONVERT(CHAR(19),GETDATE())
PRINT '2) HERE IS MM-DD-YY FORMAT ==>' +
CONVERT(CHAR(8),GETDATE(),10)
PRINT '3) HERE IS MM-DD-YYYY FORMAT ==>' +
CONVERT(CHAR(10),GETDATE(),110)
PRINT '4) HERE IS DD MON YYYY FORMAT ==>' +
CONVERT(CHAR(11),GETDATE(),106)
PRINT '5) HERE IS DD MON YY FORMAT ==>' +
CONVERT(CHAR(9),GETDATE(),6)
PRINT '6) HERE IS DD MON YYYY HH:MM:SS:MMM(24H) FORMAT ==>' +
CONVERT(CHAR(24),GETDATE(),113)

Here is the output from the above script:
1) HERE IS MON DD YYYY HH:MIAM (OR PM) FORMAT ==>Feb 5 2003 5:54AM
2) HERE IS MM-DD-YY FORMAT ==>02-05-03
3) HERE IS MM-DD-YYYY FORMAT ==>02-05-2003
4) HERE IS DD MON YYYY FORMAT ==>05 Feb 2003
5) HERE IS DD MON YY FORMAT ==>05 Feb 03
6) HERE IS DD MON YYYY HH:MM:SS:MMM(24H) FORMAT ==>05 Feb 2003 05:54:39:567"

Searching date, time data in SQL Server 2000 :

Searching date, time data in SQL Server 2000 : Narayana Vyas Kondreddi's home page

Tuesday, January 18, 2005

4GuysFromRolla.com - Data Shaping

4GuysFromRolla.com - Data Shaping

OOP in .NET: the How and Why

OOP in .NET: the How and Why: "when they are not appropriate. The fact is that there are few if any situations where you could not use OOP to good advantage. After all, any code that you could use outside of an object can also be placed within a class. It does take a bit of time to adjust to the OOP mindset so that you start thinking in terms of classes and objects as soon as you start planning a program. As you plan, think of the program's functionality in terms of both data storage and actions, and you'll start to see some of the data units and tasks that are naturals for encapsulation in a class. "

Comcast to raise broadband speed | CNET News.com

Comcast to raise broadband speed | CNET News.com: "Comcast to raise broadband speed"

ABC News: Krispy Kreme Board Ousts Top Executive

ABC News: Krispy Kreme Board Ousts Top Executive

Disaster Looms for Megacities, UN Official Says...

http://news.yahoo.com/news?tmpl=story&cid=571&u=/nm/20050118/hl_nm/disasters_cities_dc_1&printer=1