September 2006 Blog Posts
.NET: TFS Feature List / Visual Studio cross-section

posted @ Tuesday, September 26, 2006 12:17 PM | Feedback (0)
T-SQL: sqlcmd nocount oddity

osql is a command-line program to interact with Sql Server, and is useful for launching scheduled batch files of Sql commands.

Well, it is deprecated, and sqlcmd is the new program to do the same thing.

I've come across one oddity: it is common to include print statements so that the output log file is more 'human readable', and easier to grep through, etc.

In weird combinations, calling:

print 'print text'

in a batch file will log out:

“0 rows affected.” 

This should never happen with a print statement, and you should be able to supress it with:

'set nocount on'

However, that command will only produce the desired behavior when followed with an explicit 'go' command.  'Set nocount off' takes effect immediately without an explicit 'go.'

posted @ Friday, September 22, 2006 3:07 PM | Feedback (2)
C#: My Strongly-Typed DataSet is throwing StrongTypingException exceptions

This typically happens when you create a typed dataset from a database that allows null values.

For reasons not clear to me (my normal guess is “user error” but dragging and dropping tables to the DataSet designer does this), the default setting for each column's NullValue is “(Throw Exception)”, so your strongly-typed dataset is doing what you are 'telling' it to do.  (For values that aren't of Data Type System.String, you can't change this, for other reasons not clear to me).

For System.String type columns, you can change this NullValue to either be (Empty) or (Null).

For other column types, I do 'evil' things like using try-catch blocks, although it looks like you could use partial classes and modify the following and get something to work:

posted @ Wednesday, September 20, 2006 2:01 PM | Feedback (0)
Sql Server: Promoting .bas files into DTS packages using Microsoft Word

Delete the package on the destination server if it already exists.

Open DTS package (design)
Save As, Location Visual Basic File
Edit visual basic file, .bas to make changes
use these next lines to save to database and comment out execute
goPackage.SaveToSQLServer “servername", , , 256  ' you can also use sa authentication

To load
Open MS Word
Tools->Macros->Visual Basic editor
Cut and paste .bas file into editor

            check Microsoft DTSPackage Object Libray
            check Microsoft DTS Custome Tasks Object Library
            check Microsoft DTSDataPump Scripting Object Library

F5 to run


posted @ Friday, September 15, 2006 3:25 PM | Feedback (0)
T-SQL: Determine primary keys and unique keys for all tables in a database...

posted @ Thursday, September 14, 2006 2:27 PM | Feedback (0)
Spike Solutions

For some reason, I could never remember what these were called (creating some code to only test a very particular technical or design issue):

posted @ Tuesday, September 12, 2006 10:27 AM | Feedback (0)