http://support.microsoft.com/default.aspx?scid=kb;EN-US;q262499
Blogs on .NET and LAMP Technologies
There's often more than one correct thing.
There's often more than one right thing.
There's often more than one obvious thing.
--Larry Wall
Wednesday, January 31, 2007
Using Dynamic TSQL
Here is very good article on using dynamic TSQL.
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q262499
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q262499
Friday, January 19, 2007
C# Passing Comma Seperated Stored Procedure Paramter
I came across passing a very long comma seperated string as a Stored Procedure Parameter. There is character limit on SqlParameter, that is one. The second thing I didn't want to pass individual string as parameters and calling same Stored Procedure for each string. That would have been clear and present performance hit. So I wrote following piece of code to avoid this situation. Break large string into small strings that can be accepted by SqlParameter.
string tmpMatterSpaceNames = string.Empty;
int lowerLimit = Constants.SqlParamCharLimit - 200;
StringCollection objStrCollection = new StringCollection();
foreach (string matterSpaceName in objNV.AllKeys)
{
tmpMatterSpaceNames += "'" + matterSpaceName + "',";
if (tmpMatterSpaceNames.Length > lowerLimit)
{
tmpMatterSpaceNames = Regex.Replace(tmpMatterSpaceNames, @",$", "");
objStrCollection.Add(tmpMatterSpaceNames);
tmpMatterSpaceNames = string.Empty;
}
}
if (tmpMatterSpaceNames != string.Empty)
{
tmpMatterSpaceNames = Regex.Replace(tmpMatterSpaceNames, @",$", "");
objStrCollection.Add(tmpMatterSpaceNames);
}
foreach (string matterSpaceNames in objStrCollection)
objMSDao.UpdateSourceCreatedFlag (matterSpaceNames, true);
Saturday, January 13, 2007
A Day in the Life of Indian Village
Subscribe to:
Posts (Atom)