Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2007
    Posts
    56

    Unanswered: Data Extract from MSSQL db

    Hello,

    I have writing a script to export a table data in CVS file, i have handled the null values by using select @fieldname = isNull(@fieldname , ''); replace all null values by space, but this does not work , the resultant cvs file does contain some box like char in the output file, when opening the file in notepad++ Nul char is displayed where as if i open the file in MS excel then it is not displayed

    How do i get ride of this char while extracting the data.

  2. #2
    Join Date
    Mar 2007
    Location
    Holmestrand, Norway
    Posts
    332
    @fieldname would normally be a variable with named fieldname, but I guess that is a typo. To the point: isnull(field,'') works brilliant, so my conclusion would be that something else is wrong. If you write dynamic SQL, remember that you should write isnull(field,'''') instead. Otherwise, I my best call is an error in your script, most likely that it does not handle empty strings correctly.
    Ole Kristian Velstadbråten Bangås - Virinco - MSSQL.no - Facebook - Twitter

  3. #3
    Join Date
    Sep 2007
    Posts
    56
    I got it it was <start>case when @courcus0 = '' then null else @courcus0 end<end> I used this case condition and it worked.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •