Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003
    Posts
    6

    Unanswered: Error Dumping Data in SQl Server

    Im dumping data from a PostgreSql DB into SQL Server. After cleaning up the generated SQL I created my table as such:

    <code>

    CREATE TABLE certifications (
    cert_id int identity(1,1),
    seminar_date datetime NOT NULL,
    last_name varchar NOT NULL,
    first_name varchar NOT NULL,
    housing_agency varchar NOT NULL,
    seminar varchar NOT NULL,
    UNIQUE (cert_id)
    );

    </code>

    When I try to insert like so:

    <code>

    Set identity_insert certifications on
    Go
    INSERT INTO certifications (cert_id, seminar_date, last_name, first_name, housing_agency, seminar) VALUES(580, '2001-03-23', 'Dean', 'James', 'Some Finance Agency', Some Certification');

    INSERT INTO certifications (cert_id, seminar_date, last_name, first_name, housing_agency, seminar) VALUES(580, '2001-03-23', 'Dean2', 'James2', 'Some Finance Agency2', Some Certification2');

    Set identity_insert certifications off
    Go

    </code>

    (There are a few thousand records)
    I get this error:

    <error>

    Server: Msg 8152, Level 16, State 9, Line 1
    String or binary data would be truncated.
    The statement has been terminated.
    Server: Msg 8152, Level 16, State 9, Line 1
    String or binary data would be truncated.
    The statement has been terminated.

    </error>

    Any help would be greatly appreciated

    TIA

  2. #2
    Join Date
    Jul 2003
    Location
    The Dark Planet
    Posts
    1,401
    CREATE TABLE certifications (
    cert_id int identity(1,1),
    seminar_date datetime NOT NULL,
    last_name varchar NOT NULL,
    first_name varchar NOT NULL,
    housing_agency varchar NOT NULL,
    seminar varchar NOT NULL,
    UNIQUE (cert_id)
    );
    You will need to specify the width of varchar colums .. i believe that is the source of your problem
    Get yourself a copy of the The Holy Book

    order has no physical Brett in The meaning of a Kaiser . -database data

  3. #3
    Join Date
    Dec 2003
    Posts
    6
    You were correct. Thanks a bunch! -E

Posting Permissions

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