Thursday, February 25, 2010

Replicate, Repeat one value in C#

string.Concat(System.Collections.ArrayList.Repeat("0", 66).ToArray());

Convert string to Decimal in C#

(Convert.ToInt32(clm.OutOfPocketAmount) >= 0 ? (Double.Parse((clm.OutOfPocketAmount.ToString().Substring(1))) / 100).ToString("F2") : clm.OutOfPocketAmount.ToString().Substring(0, 1) + (Double.Parse((clm.OutOfPocketAmount.ToString().Substring(1))) / 100).ToString("F2"))

Friday, February 12, 2010

cannot convert between unicode and non-unicode string data types, SSIS

SSIS error:

solution
http://www.mssqltips.com/tip.asp?tip=1393

#database side

1) change the column width in database table for the error coulumn.

#SSIS package side

1) Right click 'Flatfile editor' and select 'Advanced' editor
2) Go to 'Input & Output Properties'
3) Expand 'Flat File Source Output
4) Expand the 'Output columns'
5) Select Error column and change the length.

-- Yup, refresh you're OLEDB connection with updated table information.

ready to go...

Sunday, January 31, 2010

good article

"In one of the meetings, he articulated beautifully the importance of maintaining proper work-life balance. He opined that simple attributes such as prior planning and prioritising could help achieve the right balance. In another, he talked about the importance of investing time and resources on research."



http://getahead.rediff.com/report/2010/jan/19/career-taking-meetings-with-narayana-murthy.htm

Tuesday, January 19, 2010

The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.

--Error code
DECLARE @dt VARCHAR(10)
SET @dt = '12012009'
SELECT CAST(@dt AS DATETIME)

--Working code
DECLARE @dt VARCHAR(10)
SET @dt = '20091201'
SELECT CAST(@dt AS DATETIME)

Wednesday, December 16, 2009

convert float to varchar nvarchar

When we import Excel data into SQL table it will create columns with 'Float' data type.
Here is the little trikey to convert float value to varchar/nvarchar


select top 1 convert(varchar,cast(floatNumber as decimal)) n from dbo.Mytable

Saturday, December 12, 2009

hardest interview question job site

1 Hardest Job Interview Question

http://www.linkedin.com/groupAnswers?viewQuestionAndAnswers=&discussionID=10692981&gid=40717&trk=EML_anet_qa_ttle-cDhOon0JumNFomgJt7dBpSBA

Top 100 Niche Job Sites
http://newgradlife.blogspot.com/2009/12/top-100-niche-job-sites.html