Showing posts with label sql-server. Show all posts
Showing posts with label sql-server. Show all posts

July 18, 2011

SSRS special character issue in Html/CSV download, UTF-8

Special character means other than ASCII it could be French/Spanish etc. Sometime while working simple mistake cause this special character issue, special character appears as "?" or some other character.

This happens when special characters are not treated specially, for special character we should use UTF-8 encoding rather then ASCII.
SQL Server Reporting service there are option of Html and csv (download).


byte[] result = null;
                string format = @"CSV";
                string devInfo = null;
                string encoding;
                string mimeType;
                string[] streamIDs = null;
                string historyID = null;
                Warning[] warnings = null;
                ParameterValue[] reportParameters = null;
                ReportData reportData = null;

1) line to be updated
devInfo =  @"True";
rather than following.....
                    //devInfo = @"ASCII";
2) reportData.ReportOutData = Encoding.UTF8.GetString(result);
rather than
reportData.ReportOutData = Encoding.ASCII.GetString(result);


3) //Save CSV if (its csv)

File.WriteAllText(file, header+Output, Encoding.UTF8);
//header because in devInfo we have set it to NoHeader, so manually we need to set  it.

it will sure resolve the issue

Comment if it resolve/not-resolve the issue

September 01, 2008

clustered vs non-clustered Index sql server

Question: difference between clustered and non-clustered Indexing,

following are some compiled differences list. May be useful for you.
if useful & more info to add please comment if anything wrong please criticize

1. Only one clustered and 249 nonclustered indexes.

2. Clustered index can be on primary key and other.

3. If you don’t want to create clustered index on primary specify it.

4. SQL Server determines whether to use an index by examining only the first column defined in the index. For example, if you defined an index on FirstName, LastName and a query is looking for LastName, this index would not be used to satisfy the query.

January 16, 2008

clustered vs non-clustered Index sql server

Question: difference between clustered and non-clustered Indexing,

following are some compiled differences list. May be useful for you.
if useful & more info to add please comment if anything wrong please criticize

1. Only one clustered and 249 nonclustered indexes.

2. Clustered index can be on primary key and other.

3. If you don’t want to create clustered index on primary specify it.

4. SQL Server determines whether to use an index by examining only the first column defined in the index. For example, if you defined an index on FirstName, LastName and a query is looking for LastName, this index would not be used to satisfy the query.