Sunday, January 6, 2013

Earn dollars with discussion on internet


If you want to earn money on internet mylot.com is good option for you. mylot.com is site where you get paid for the discussion done in the form of thoughts exchanged pretty much similar we do like in forums. Here you can start discussions, respond to existing discussion. The Payment model is also simple through PayPal account. You get paid out with minimum amount of 10 dollar as you earn.so start discussion at mylot.

Wednesday, December 8, 2010

Clear Execution Plan for Stored Procedure

Whenever we execute stored procedure, execution plan is generated and used by database engine while executing the same stored procedure next time. However, for debug purpose we need to log time taken by stored procedure with different sets of data. The execution plan must be cleared to record exact time taken by each set of data. For this purpose Microsoft has provided few Database Console Commands. 

DBCC freeproccache can be used to clear the all execution plan stored. 

For further details on this read at

Monday, December 6, 2010

XmlDocument.InnerXml causing APPCRASH

"SSIS debug Host has stopped working" this was production issue I encountered couple of days back. After lots of comments in my DLL I was able to trace that it was XmlDocument.InnerXml
which was causing this problem.

Following is error detail :

Description:
Stopped working

Problem signature:
Problem Event Name: APPCRASH
Application Name: DtsDebugHost.exe
Application Version: 2009.100.1600.1
Application Timestamp: 4bb67978
Fault Module Name: kernel32.dll
Fault Module Version: 6.0.6001.18215
Fault Module Timestamp: 4995354a
Exception Code: e053534f
Exception Offset: 000000000002619d
OS Version: 6.0.6001.2.1.0.274.10
Locale ID: 1033

If you get such type of error just check for XmlDocument.InnerXml.
this is strange but i was not able to figure it out, what was actual
reason which causes XmlDocument.InnerXml to APPCRASH.

Search anything in your data base with Sql search a red gate free tool

Red Gate has give free SQL search tool.SQL search is good tool for searching part of word in table ,SP,view in almost all objects in MS SQL.

Following is screen shot of search performed.



It also opens up the object found by just double clicking on it.




I found this tool use full you can try by downloading it from

http://www.red-gate.com/products/SQL_Search/


Bulk insert by SqlBulkCopy

SqlBulkCopy is great option provided by microsoft to insert bulk records with flexibilty to define BatchSize and BulkCopyTimeout. I have used it ,it is really very fast as it does not write logs in database.

following is example for SqlBulkCopy.


private void BulkInsertData(DataSet objDS)
{
if (objDS != null)
{
if (objDS.Tables[0] != null)
{
DataTable sourceData = objDS.Tables[0];

using (SqlConnection destinationConnection = new SqlConnection(connectionString))
{
// open the connection
destinationConnection.Open();
using (SqlBulkCopy bulkCopy = new SqlBulkCopy(destinationConnection.ConnectionString))
{
bulkCopy.BulkCopyTimeout = 0; //sets no time limits
bulkCopy.BatchSize = 5000;
// column mappings
bulkCopy.ColumnMappings.Add("A", "A");
bulkCopy.ColumnMappings.Add("B", "B");
bulkCopy.ColumnMappings.Add("C", "C");
bulkCopy.ColumnMappings.Add("D", "E");

bulkCopy.DestinationTableName = "DestinationTableName";
bulkCopy.WriteToServer(sourceData);
}
}

sourceData.Clear();
sourceData.Dispose();
}
}

}

Map the columns required for bulk insert and provide data in datatable to function WriteToServer which will do work of bulk insert to MSSql table.

Saturday, December 4, 2010

Swap two variables without using third variable

Following is example to solve this problem.

suppose you have following two variable

a=6;
b=7;

Solution :

Function Swap(ref int x,ref int y)
{
x=x+y; //x=6+7 , x=13
y=x-y; //y=13-7, y=6
x=x-y; //x=13-6, x=7
}

Thursday, July 12, 2007

ASP page execution.

When anybody type particular web address of asp page in browser and clicks on go.
Following things happens.
1. IIS takes request and send it to Asp.dll that is asp engine.
2. Engine executes asp page and convert it to pure HTML file and send this to browser.

This is how asp page is executed.