.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
MarieAdela
Imran Ghani
Post New Web Links

Strange characters exporting a blob file using bcp

Posted By:      Posted Date: September 15, 2010    Points: 0   Category :Sql Server
 
Hi, I am trying to insert and export a binary file into SQL 2005. I need that word, pdf and txt file work. I can't use file path and this is the only choice I have. I am using this way: 1) Create a file test.txt and write "hello" into it. 2) CREATE TABLE [dbo].[myfiles]( [file] [varbinary](max) NOT NULL) ON Primary 3) INSERT INTO [myfiles]([file]) SELECT BulkColumn FROM OPENROWSET ( BULK 'C:\test.txt', SINGLE_BLOB) AS BinFile 4) declare @SQLcommand nvarchar(4000) set @SQLcommand =       'bcp "SELECT top 1 [file] FROM myfiles" queryout "c: \temp\test.txt" -T -n -SMYPC' exec xp_cmdshell @SQLcommand When I open file c:\temp\test.txt I can see strange characters before "hello" Trying to insert a word file says me that the file is corrupted. How can I solve this ? Thanks.


View Complete Post


More Related Resource Links

reading some strange file

  
hi all,I have a file that i want to read created by a program from another company.I fi open the file in notepad it has all kind of funny chars in it, i tried different ways of reading it in vb.net but the funny chars stay.Anyone has any idea how to read something like this?this is an extract from the file  Z "f 2006/05/19 13:44:28 < ----------- uStreetname 91 1745 Opwijk                                                                                  ' 590208356329 SLIN3f )lÿ%g: )' 29.11.2005grtz & thnx to anyone who looked into this.bjorn

How do you specify special characters as flat file delimiters?

  
I have a flat file that has fields delimited by tilde {~} and rows delimited by {CR}{LF}.  The problem is, my source is spitting out the {NULL} (&H00) at the end of the row. The data displays correctly in the pre-viewer (with a non-print symbol at the end of the last field), but gives an error when I try to run the package. Example: "data"~"data"~"data"{NULL}{CR}{LF} I can process the row in c# using: "\0\r\n" as the row delimiter.   What is the equivalent notation for SSIS?   Thanks,

Drag drop functinality not working on Explore View control for file containing special characters in

  
We have created a control which uses explorer view control for file drag and drop. This functinality works fine for a file having filename without special characters but it gives an error if we drag and drop a file having special characters in the file name. The reason for this is Sharepoint uses WebDAV protocol for file transfer to the Sharepoint document library and WebDAV protocol has limitation that it does'nt accept file with special characters. Please let me know the way how I can accomplish drag and drop of file with special characters in file name, onto Explorer View control with WebDAV.

Drag drop functinality not working on Explore View control for file containing special characters in

  
We have created a control which uses explorer view control for file drag and drop. This functinality works fine for a file having filename without special characters but it gives an error if we drag and drop a file having special characters in the file name. The reason for this is Sharepoint uses WebDAV protocol for file transfer to the Sharepoint document library and WebDAV protocol has limitation that it does'nt accept file with special characters. Please let me know the way how I can accomplish drag and drop of file with special characters in file name, onto Explorer View control with WebDAV.

Lookup column output includes strange characters.

  
Hi all, I have a lookup column ("Priority"), that returns a number, which it looks-up from a different list (obviously). I have a workflow that emails the user when the list item is created, and in that email I have included the Priority field. However, the email is showing the contents of the Priority field along wth other characters - an example is: The column in the list says 3 The column in the email says 3;#3 What's going on? Why is it adding the additional characters to it? I'm not sure where it's coming from? This only seems to happen where a lookup column contains a number. Thanks in advance. Duncan

Descompress BLOB data form SQL server into a file

  
Hello guys..... I have a question for developers in SQL Server. I need to migrate data from one table to another, i will use SSIS to do the job, i have no problem with this, but during the migration i need to read a column that contains BLOB data (documents .docx .xlsx .pdf etc) and generate and sownload the file in a folder directory. I need to implement this functionality into SQL entorn (SSIS package), do you know if exist any function in SQL that could do the job, or any extend functionality form .net that could be included or called from SQL SSIS in order to be executed? I will appreciate your support, thanks. PS        

SharePoint file url more than 256 characters length problem

  
Hi, I am facing a small issue which is giving big trouble. We are having lots of data in hard drive and for giving access to all users, we have planned to move data to SharePoint. While moving data, when there are multiple folders in a root directory. So, url grown more than 256 characters and when I try to upload the file it is giving the exception message. Below are the details of my SharePoint server. Version: 12.0.6425.1000 And I followed the support KB article and tried to install this. http://support.microsoft.com/kb/956056/ But, the version the KB article showing as  12.0.6327.5000. So, when I run the hotfix in my system, it is saying this fix is not for the version installed. So, not able to find out the problem. Can you please suggest me any other solution? Because of this issue, we are not able to move/migrate data. thanks for all your help.   ASP.NET and SharePoint developer Company: http://www.rampgroup.com/ Blog: http://praveenbattula.blogspot.com

parsing tab delimited spanish characters file

  

Using vb.net/asp.net 2005.

another spanish character issue:  I am parsing special spanish characters, removing the tildes (EX:  "ñ" becomes "n") that customers send us in files, in tab delimited files that is.

When the characters are valid spanish characters (like "ñ") then this is not an issue, however some of the files that we get have characters such as:

"Ni±o"

Which should actually be:

"Niño"

Has anyone seen this and know any solution?  The "ñ" is fine but I am not certain what to do about the "±".

this is only one example, other spanish characters are listed as a question mark "?" so this is causing some issues.


thanks

MC



Control Characters in Log file

  

SQLMessage = "This task ran at " & Now() & " - InfoMessage - "

 Dim sw As StreamWriter
        Dim path As String = outputfilepath
        Try
            'Append test to existing log file
            sw = File.AppendText(path)
            sw.WriteLine(SQLMessage)
            sw.Flush()
            sw.Close()
        Catch ex As Exception

        Finally
        End Try


In some of my logs I see this:

Actually I can't show you what I'm seeing

When I copy the Control characters from Notepad to here they are converted to Chinese characters!! ARGH!

Obviously I'd expect to at least see the
This task ran at <<time>>  - InfoMessage -

Where does this control string come from that gets written to the log file??

I'd seen the large log files were all looking like this.  I cl

unable to unzip XML file with unicode characters in it's name.

  

Finally I did manage to build an application that supports unicode characters..

Now my application generates a zip file which contains an XML file. I want to unzip the zip file to view the contents of an XML file.

i am unable to unzip because the name of the zip file/as well as XMl file has Unicode characters(i.e. japanese Name) and it gives some error.

 

If i generate the XML file  with same contents but name of the files in English then i can view the contents of the XML file.

 

My query is i want to be able to unzip the XML file when the name of the file contains unicode characters in it.

as per my research up till now,  we either require a compatible winzip software or we have to create an utility for the same.

I need to know how to go about it. It's a little urgent as well.

Thnx in advance.

 

 I can unzip file with the name: PMTI_MSPS_US_GAB_JAPANESE_PWA_Project Plan1_PPM_2010100105260495.zip

 

I am unable to unzip the file with the name: PMTI_MSPS_US_GAB_JAPANESE_PWA_????????1_PPM_2010093006260431.zip

I wanto unzip this file.


Opening file causes strange message

  

when I save the file that is returned by Handler and try to open it I get the following message:"The file you trying to open, 'Users.xls', is in a different format than specified by the file extension. Verify that the file is not corrupt and is from a trusted source before opening the file. Do you want to open the file now?"

How to fix this?

Here the code of the handler:

using System.Web;
using System.Web.Services;
using System.IO;
using System.Data;
using System.Web.UI.WebControls;
using System.Web.UI;
using System.Text;

namespace WebApplication1
{
    public class Handler2 : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
            string query = "SELECT FirstName, LastName, Email, Phone FROM tblUser WHERE IsSubscribed = 1";
            // As QueryDataSql = New QueryDataSql(query)

            DataTable dt = new DataTable();
            GridView gv = new GridView();

            dt.Columns.Add("FirstName");
            dt.Columns.Add("LastName");
            dt.Columns.Add("Email");
            dt.Columns.Add("Phone");


            DataRow dr = dt.NewRow();
            dr["First

Importing xls file, looking up shortcodes and then exporting to xls or cvs with columns in certain o

  

Hi

I am looking to import an xls file and then for 2 columns in this document I need to look up the shortcodes which are in another document eg London Heathrow is LHR in the lookup table. I need to do that for data in 2 columns and then export the data into xls format or can be cvs, but the column order in the outputted document need to be different to when they were imported how can I go about doing this?

Hope this makes sense

Thanks in advance

Pete


reading TXT file with (èàò) and return strange character

  
  Private Function Traduci(ByVal file As String)

    Dim testo As String = My.Computer.FileSystem.ReadAllText(file)

    Dim righe As String()
    righe = Split(testo, vbCrLf)

    For i As Integer = 0 To righe.Length - 1
      Debug.Print(testo)
    Next

  End Function<br/>

i am trying to read an TXT fiel with this function
in my example.txt i have this row:"pèpòàèpòàpèòp+p"

but the program returns": p?p???p??p??p+p"
is the charset the problem? if yes where can i set it?


hi

Rename file having special characters when uploading to document library

  

Hi,

i am trying to use the ItemAdding event handler to capture the filename and rename it when uploading. But it doesn't work.

Does anyone have any idea which event should i consider OR is there any other solution??

Thanks


Custom Workflow deployed:Feature activation error:The file or folder name contains characters that a

  

Hi,

I am migrating custom workflow which was running in moss 2007 to SharePoint 2010.The approach was i created a new Sequential workflow project in VS 2010 under sharepoint . then i copied my Workflow files.Removed old refernces to 12 hive and updated to 14 root.

I could successfully buid this project.Then i have added Module project item called 'Forms' where i placed my Intiation form which is a infopath published form to nework location.

I could package and deploy the solution.But facing an error while Activating the feature.the error is The file or folder name contains characters that are not permitted.  Please use a different name.

 

Any help will be highly appritiated

 

Regards

Ram kiran

 


Feature Activation error:The file or folder name contains characters that are not permitted. Please

  

Hi,

I am migrating custom workflow which was running in moss 2007 to SharePoint 2010.The approach was i created a new Sequential workflow project in VS 2010 under sharepoint . then i copied my Workflow files.Removed old refernces to 12 hive and updated to 14 root.

I could successfully buid this project.Then i have added Module project item called 'Forms' where i placed my Intiation form which is a infopath published form to nework location.

I could package and deploy the solution.But facing an error while Activating the feature.

 

Any help will be highly appritiated

 

Regards

Ram kiran


Strange Flat File results

  

OK, I am not even sure I can explain this let alone know what is going on.

SQL 2008 enterprise, 64 bit.

We have a stored procedure (no changes between working and not working).

Running this against the same server file folder, same security credentials, from the BI tool, is just fine. When run from a SQL server job, results as below.

SSIS job basically execs this stored procedure, which just selects and formats the data.

The SSIS package creates a CSV file on a Win. Server.

All of a sudden (I know there is no all of a sudden) it creates this CSV file as such:

_x003C_none_x003E_"MOORING"_x003C_none_x003E_,_x003C_none_x003E_"RANDY"_x003C_none_x003

Instead of as such:

"MOORING","RANDY"

 

I've tried a number of things, and like I said it works on my PC within the VS.

 

Ideas on either fixing it or troubleshooting it?


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend