Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Export data in SQL 2008

Export data in SQL 2008

Scheduled Pinned Locked Moved Database
cssdatabasequestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vkEE
    wrote on last edited by
    #1

    Hi, I just used the Import Export functionality in sql 2008 to export a table having about one million rows. I have exported to a flat file, and delimited with pipes. For some reason, about 23,000 rows below, the one of the fields expands and as a result pulls down to the next row, creating a blank row, the data hence after is fine. Now and then we are getting these blank rows. I have confirmed this data is of length 40 characters long or less. What could be causing the odd line breaks in the flat file? any ideas appreciated!! Thanks!

    Richard DeemingR 1 Reply Last reply
    0
    • V vkEE

      Hi, I just used the Import Export functionality in sql 2008 to export a table having about one million rows. I have exported to a flat file, and delimited with pipes. For some reason, about 23,000 rows below, the one of the fields expands and as a result pulls down to the next row, creating a blank row, the data hence after is fine. Now and then we are getting these blank rows. I have confirmed this data is of length 40 characters long or less. What could be causing the odd line breaks in the flat file? any ideas appreciated!! Thanks!

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      Is there a carriage-return or line break embedded in the field? If you can isolate one of the affected rows, try dumping the characters from the affected field:

      DECLARE @FieldValue varchar(100);
      SELECT @FieldValue = AffectedField FROM AffectedTable WHERE Key = @AffectedKey;

      WITH E1(N) AS
      (
      SELECT 1
      UNION ALL SELECT 1
      UNION ALL SELECT 1
      UNION ALL SELECT 1
      UNION ALL SELECT 1
      UNION ALL SELECT 1
      UNION ALL SELECT 1
      UNION ALL SELECT 1
      UNION ALL SELECT 1
      UNION ALL SELECT 1
      ),
      cteNumbers (N) As
      (
      SELECT
      ROW_NUMBER() OVER (ORDER BY (SELECT NULL))
      FROM
      E1 a, E1 b -- Cross-join = 100 rows
      )
      SELECT TOP(LEN(@FieldValue))
      N,
      Ascii(Substring(@FieldValue, N, 1)) As AsciiCode,
      Substring(@FieldValue, N, 1) As Character
      FROM
      cteNumbers
      ORDER BY
      N
      ;

      You're looking for either a 10 or a 13 in the AsciiCode column.


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups