Thursday, November 13, 2008

Blog moved to WordPress

I have moved this blog to WordPress. Please refer to http://smehrozalam.wordpress.com/ for further posts.

Have a nice day.

Labels:

Thursday, November 06, 2008

SSIS: How to use a query containing table variables for an OLE DB Source

For a more recent version, please visit: http://smehrozalam.wordpress.com/2008/11/06/ssis-how-to-use-a-query-containing-table-variables-for-an-ole-db-source/

This one consumed a lot of my brain energies yesterday. I was working on some Sql Server Integration Services task and needed to create a complex query containing table variables. The query was working fine in SQL Management Studio and the SSIS designer was even previewing the data correctly. But when the task was actually executed, the query did not return any rows. I posted a question on TechNet forums and got an answer from Charles Talleyrand here. Actually, I needed a SET NOCOUNT ON statement. Let me explain using an example:

Say, I want to create a table variable (not a temp table), populate it and then use the result set as an input for an OLE DB Source. Here's a sample query for this:


declare @mytable table
(
col1 int,
col2 varchar(20)
)

insert @mytable values (1, 'one')
insert @mytable values (2, 'two')
insert @mytable values (3, 'three')

select * from @mytable


The SSIS designer will correctly identify the column names from the above query and even display the data if you click on the Preview button. But when the task is executed, no rows will be returned. I think the output of insert statements: i.e. 1 row(s) affected was the source of problem and so a SET NOCOUNT ON prevented such interferences. Hooray!! So if you are ever working on some SSIS Data Transfer Task and want to use table variables inside your query, make sure you do not forget the SET NOCOUNT ON statement.

Labels: , ,

Wednesday, October 29, 2008

More controls for Silverlight: Silverlight Toolkit Released

Microsoft has released some new controls for Silverlight 2 with full source codes. These new controls include:

  • AutoCompleteBox
  • Chart
  • DockPanel
  • Label
  • Expander
  • TreeView
  • UpDown
  • ViewBox
  • WrapPanel
  • ImplicitStyleManager
  • Themes

Check out: http://www.codeplex.com/Silverlight

Wednesday, October 08, 2008

Command Prompt Here option

Developers typically need a quick shortcut to opening command prompt in any folder they want. Here's what I personally use:

Create a new file AnyName.reg and edit it to enter the following text:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\OpenNew]
@="Command Prompt Here"
[HKEY_CLASSES_ROOT\Directory\shell\OpenNew\Command]
@="cmd.exe /k cd %1"


Run the file to update the registry. Now, you will get a "Command Prompt Here" option whenever you right click on any folder.

Monday, September 29, 2008

mscorsvw.exe taking up 100% cpu after VS2008 SP1

Today, when I installed VS2008 SP1 on my office PC, I noticed that one of my cores are totally captured by mscorsvw.exe. A quick google search reveled that this service is used to precompile .NET assemblies. If you ever encounter this, then run ngen.exe executequeueditems, this will compile all the queued assemblies, followed by a restart. After reboot, your CPU will return to normal. Hoooray.

Reference: David Natario's WebLog

Labels: , ,

Friday, September 26, 2008

Silverlight 2 RC0 Released

Finally, the first public release candidate version has been released. InshaAllah, I will have more posts on this after Ramadhan.

A few links:
Official site: http://silverlight.net/GetStarted/sl2rc0.aspx
ScottGu's blog: http://weblogs.asp.net/scottgu/archive/2008/09/25/silverlight-2-release-candidate-now-available.aspx

Labels: , ,

Tuesday, August 12, 2008

Silverlight article posted at CodeProject

At last, I was able to complete and post my article: "My First Data Application in Silverlight" at CodeProject here: http://www.codeproject.com/KB/silverlight/MySilverlightDataApp.aspx
This one is a detailed article intended for beginners starting Silverlight. It discusses how data from a database can be retrieved and displayed in a silverlight application. It discusses how LINQ objects are returned using a WCF service and consumed in a silverlight application. On the layout side, it looks at the ListBox and DataGrid and provides an introduction to the data templates too. I think that most of the silverlight programmers have past experience of ASP.NET so I also discussed the similarities between ASP.NET and Silverlight. I hope people will find this article beneficial.

Labels: , , , , , , , , , ,