Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004

    Unanswered: Data manipulation

    I tried searching for this but i'm unsure what to look for.

    I'm trying to export 12 select columns from a YaBBSE table into 12 specific columns in a Postnuke table.

    Now, I've already done a sql dump and tried reordering the data from YaBBSE to match the PN table, but this is too time consuming with lots of members and their related information.

    So I've exported the 12 columns I need from the member table and this is also sorted basically in the order it needs to be inserted. The query I came up with is:

    `ID_MEMBER` , `memberName` , `realName` , `websiteUrl` , `avatar` , `dateRegistered` , `ICQ` , `location` , `signature` , `AIM` , `YIM` , `MSN` , `bio`
    FROM `members`
    WHERE 1 LIMIT 0 , 30

    to import i've tried the following:
    VALUES (
    `pn_uid` , `pn_name` , `pn_uname` , `pn_email` , `pn_url` , `pn_user_avatar` , `pn_user_regdate` , `pn_user_icq` , `pn_user_from` , `pn_user_sig` , `pn_user_aim` , `pn_user_yim` , `pn_user_msnm` , `pn_bio` )

    The problem I'm running into is that the column count is less than whats in the table.

    FYI of the 30 columns in both tables/databases, only these 12 are similar and therefore "interchangeable"

    I would greatly appreciate anyones input. Thanks

  2. #2
    Join Date
    Mar 2004
    It looks like the table you are exporting does not have an email column attributed to it while the new table has an email column. Are you adding the info by 'hand' for email into the second table or have you missed a column in your export?

    If the table you are exporting doesn't have an email column and you plan on adding that data in later then drop the email column from the new table and add it in place later after you have imported the data. You can tell the column explicitly where it should be inserted in your alter statement.

    ALTER table PN ADD email varchar(100) AFTER pn_uname;

  3. #3
    Join Date
    Apr 2004

    Well the missing email column was something I overlooked.

    I hadn't actually put the 2 queries together to run back-to-back; I was trying to simplify things and do each step individually, so the extraction went ok, it was 'putting' the data somewhere else that was causing problems - only I wasn't actually putting data anywhere just trying to put the statement together..that's where I went wrong, because from the import statement below I'm trying to put `pn_uid` , `pn_name` etc as the data instead of my intention of 'where the data should go' and than assign data with VALUE. oops

    Your reference to dropping the email column helped me realize what I was doing wrong, because from you were mentioned how to manipulate the columns.

    Thanks again

    Here's how it should be:
    `nuke_users` ( `pn_uid` , `pn_name` , `pn_uname` , `pn_email` , `pn_url` , `pn_user_avatar` , `pn_user_regdate` , `pn_user_icq` , `pn_user_from` , `pn_user_sig` , `pn_user_aim` , `pn_user_yim` , `pn_user_msnm` , `pn_bio` )

    ( 4, '', 'test-2', '', '', 'blank.gif', '1081439084', '123456789', 'location', 'sig block', 'aim id', 'yim id', 'msnm id', 'bio stuff' )

Posting Permissions

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