Results 1 to 4 of 4
  1. #1
    ysrini is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2010
    Posts
    10

    Add new column in a select query

    Hi, i want to create a table B by using a select query on table A,


    and also add a new column in table B initialized to ''

    If i do
    select T.*,'' AS new_col1 into B
    from T;

    The above works, but when i add data to table B, it fails with 'Numeric overflow' error, and i guess it's because the type of new_col1 is not defined
    How do i defined new_col1 in the select query itself?

    I guess it should be something like
    select T.*,''(text(20)) AS new_col1 into B
    from T;

    but i couldn't figure out the correct syntax
    Any help would be appreciated
    Thanks
    -srinivas

  2. #2
    llkhoutx is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Jan 2010
    Location
    Houston, Texas USA
    Posts
    373
    Code:
    select T.*,-as B from T 
    or
    Code:
    select T.*,12/31/09 as B from T 
    or
    Code:
    select T.*,"Dufus" as B from T 
    or
    Code:
    select T.*,3.1416 as B from T 

  3. #3
    ysrini is offline Novice
    Windows XP Access 2003
    Join Date
    Jan 2010
    Posts
    10
    Thanks llkhoutx, but i want to initialize as '' (empty)
    in the select statement itself

  4. #4
    llkhoutx is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Jan 2010
    Location
    Houston, Texas USA
    Posts
    373
    Code:
    select T.*,Null as B from T 

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Empty Column in Query
    By sesproul in forum Queries
    Replies: 3
    Last Post: 01-18-2010, 06:04 PM
  2. Query to get column names in a table
    By access in forum Queries
    Replies: 1
    Last Post: 07-06-2009, 05:10 AM
  3. Query to get column names in a table
    By access in forum Forms
    Replies: 1
    Last Post: 07-01-2009, 02:50 PM
  4. inserting values in column based another column
    By wasim_sono in forum Database Design
    Replies: 1
    Last Post: 06-27-2006, 05:23 AM
  5. 2 different fields into 1 column by query?
    By rainxking in forum Queries
    Replies: 1
    Last Post: 06-04-2006, 09:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums