Results 1 to 11 of 11
  1. #1
    Join Date
    Apr 2003
    Location
    Washington DC area
    Posts
    1,770

    Red face Unanswered: SQL Conversion of data types in table creation from insert into

    Hey,


    I have a large table and a number of data types need to be converted during the import process or during a insert into process. When attempting to convert the data types in a table with #1 and drop the original I get a error that it cannot be done. Any suggestions????

  2. #2
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    what was the specific error? where is the code?
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  3. #3
    Join Date
    Apr 2003
    Location
    Washington DC area
    Posts
    1,770
    Select Convert ApplicationID (float, int) Unchecked,
    ReqGrantPeriodFr datetime Checked,
    ReqGrantPeriodTo datetime Checked,
    ReqOutrightAmount (float, money) Unchecked,

    ReqMatchAmount (float, money) Unchecked
    from tblAppliHist;

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Quote Originally Posted by garrydawkins View Post
    Any suggestions????
    Read the error message and do what it suggests, or give us more information in the form of:
    1. The CREATE TABLE to build the source table, including all constraints.
    2. The SELECT ... INTO ... which caused the problem
    3. Sample data which breaks when you try to convert it (doesn't need to be real data, but needs to break).
    4. Either the SQL Server build number, or Version/Edition/Patch level.
    5. The text of the error message that you got
    6. The contents of the SQL Server errorlog

    With that information, we can help you... Without it, we're pretty much blind.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  5. #5
    Join Date
    Apr 2003
    Location
    Washington DC area
    Posts
    1,770
    Understood,

    All I have is theory today. The server down. I' just prepping for the next phase of migration.

  6. #6
    Join Date
    Apr 2003
    Location
    Washington DC area
    Posts
    1,770
    The Server back up and I have the error messages.
    Select Convert ApplicationID (float, int) Unchecked
    FROM [dbo].[tblApplicationHistory3]

    Msg 2809, Level 16, State 1, Line 1
    The request for procedure 'tblApplicationHistory3' failed because 'tblApplicationHistory3' is a table object.

  7. #7
    Join Date
    Apr 2003
    Location
    Washington DC area
    Posts
    1,770
    Msg 102, Level 15, State 1, Line 1
    Incorrect syntax near 'ApplicationID'.

  8. #8
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    Quote Originally Posted by garrydawkins View Post
    The Server back up and I have the error messages.
    Select Convert ApplicationID (float, int) Unchecked
    FROM [dbo].[tblApplicationHistory3]

    Msg 2809, Level 16, State 1, Line 1
    The request for procedure 'tblApplicationHistory3' failed because 'tblApplicationHistory3' is a table object.
    That is not valid syntax. What is it trying to do? Are you converting that column to an INT or a FLOAT?

    Select Convert (float,ApplicationID)
    FROM [dbo].[tblApplicationHistory3]

    OR

    Select Convert (int,ApplicationID)
    FROM [dbo].[tblApplicationHistory3]

    Although I prefer to use cast.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  9. #9
    Join Date
    Apr 2003
    Location
    Washington DC area
    Posts
    1,770
    from float to int

  10. #10
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    so did you try the second one...

    Select Convert (int,ApplicationID)
    FROM [dbo].[tblApplicationHistory3]
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  11. #11
    Join Date
    Apr 2003
    Location
    Washington DC area
    Posts
    1,770
    Yes, with the same result.

Posting Permissions

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