May 2004 - Posts

29 May 2004
Executing a DTS Package From .NET
A discussion between some peers of mine came up the other day about executing a SQL Server DTS package from an ASP.NET web page. The actual best practice is to invoke a stored procedure that in turn calls the DTS package you wish to run, however thanks to the simplicity of creating a RCW (runtime callable wrapper) via the VS.NET IDE on the legacy unmanaged Microsoft DSTPackage Object Library (located in your SQL Server installation directory in Tools\Binn\dtspkg.dll, also listed on the COM tab in the Add Reference dialog in the IDE), you can invoke a DTS package directly from code if you so wish. Just as a refresher, adding an RCW from the IDE is accomplished by: Project references dialog (right click references, add reference) Find Microsoft DTSPackage Object Library in the exhaustive list of objects on the COM tab Select it, add it...voila. The IDE automagically generates the correct interop assembly and places it in the bin folder, ready for instantiation The actual code itself is straightforward... Read More...
20 May 2004
SQL Server -- TOP vs ROWCOUNT (a partial explanation)
I learned something new today...I love it when that happens. A friend of mine was trying to figure out how to accomplish something like the following via TSQL (I will use the SQL Server pubs database for simplicity sake): USE pubs GO DECLARE @TOP INT SET @TOP = 20 SELECT TOP @TOP fname, lname FROM employee --etc Query Analyzer will generate an error similar to: Server: Msg 170, Level 15, State 1, Line 5 Line 5: Incorrect syntax near '@TOP' . It would appear that you cannot use a variable for the parameter of the 'TOP' keyword. So, how to work around this? With a little bit of investigating/playing around/trial and error, I discovered that the same desired end result can be accomplished using the ROWCOUNT keyword. Here is an example: USE pubs GO DECLARE @RowCount INT SET @RowCount = 20 SET ROWCOUNT @RowCount SELECT fname, lname FROM employee Voila, you will only get the first 20 rows returned from the query, the ROWCOUNT keyword is quite happy taking in a variable as its parameter. Read More...
14 May 2004
Fly Me to the Moon
Let me play...amongst the stars. I wonder if Paul Allen does charity work? I have to wonder what kind of market there will be for something like this though...it seems almost like a rollercoaster for the uber rich. Very interested to see where this concept goes. Read More...
05 May 2004
Mono Beta 1 Unleashed
Mono Beta 1 has been released by Miguel et al. More comments to come as I play around with it. Read More...