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( '(###) ### - ####' )"