title: Using SQL Server spatial types in SSIS data load
body: <p>I am trying to load a file using the SQL Server Import Data function - appending rows to an existing table.</p>
  
  <p>my existing table is created like this:</p>
  
  <pre><code>CREATE TABLE [dbo].[load](
      [Long] [varchar](50) NULL,
      [Lat] [varchar](50) NULL,
      [Geog]  AS ([geography]::STGeomFromText(((('POINT('+[Long])+' ')+[Lat])+')',(4326)))
  )
  </code></pre>
  
  <p>however when the load tries to execute i see the following error messages. I believe the issue is around the computed column 'Geog' as the data loads fine when i take this out of the table definition.</p>
  
  <blockquote>
    <p><strong>Error 0xc0202009:</strong> Data Flow Task 1:
    SSIS Error Code DTS_E_OLEDBERROR.  An
    OLE DB error has occurred. Error code:
    0x80004005. An OLE DB record is
    available.  Source: "Microsoft SQL
    Server Native Client 10.0"  Hresult:
    0x80004005  Description: "While
    reading current row from host, a
    premature end-of-message was
    encountered--an incoming data stream
    was interrupted when the server
    expected to see more data. The host
    program may have terminated. Ensure
    that you are using a supported client
    application programming interface
    (API).".  (SQL Server Import and
    Export Wizard)   <strong>Error 0xc0209029:</strong>
    Data Flow Task 1: SSIS Error Code
    DTS_E_INDUCEDTRANSFORMFAILUREONERROR.
    The "input "Destination Input" (47)"
    failed because error code 0xC020907B
    occurred, and the error row
    disposition on "input "Destination
    Input" (47)" specifies failure on
    error. An error occurred on the
    specified object of the specified
    component.  There may be error
    messages posted before this with more
    information about the failure.  (SQL
    Server Import and Export Wizard)
    <strong>Error 0xc0047022:</strong> Data Flow Task 1:
    SSIS Error Code
    DTS_E_PROCESSINPUTFAILED.  The
    ProcessInput method on component
    "Destination - load_school" (34)
    failed with error code 0xC0209029
    while processing input "Destination
    Input" (47). The identified component
    returned an error from the
    ProcessInput method. The error is
    specific to the component, but the
    error is fatal and will cause the Data
    Flow task to stop running.  There may
    be error messages posted before this
    with more information about the
    failure.  (SQL Server Import and
    Export Wizard)</p>
  </blockquote>