downloads.teradata.com Open in urlscan Pro
153.65.20.190  Public Scan

URL: https://downloads.teradata.com/forum/database/insert-values
Submission: On December 11 via manual from US — Scanned from DE

Form analysis 1 forms found in the DOM

POST /forum/database/insert-values

<form action="/forum/database/insert-values" method="post" id="search-block-form" accept-charset="UTF-8">
  <div>
    <div class="container-inline">
      <h2 class="element-invisible">Search form</h2>
      <div class="form-item form-type-textfield form-item-search-block-form">
        <label class="element-invisible" for="edit-search-block-form--2">Search </label>
        <input title="Enter the terms you wish to search for." class="single-forum-search form-text" type="text" id="edit-search-block-form--2" name="search_block_form" value="" size="15" maxlength="128">
      </div>
      <div class="form-actions form-wrapper" id="edit-actions"><input type="submit" id="edit-submit" name="op" value="Search" class="form-submit"></div><input type="hidden" name="form_build_id"
        value="form-_rD1mlZbgNWnP4t9YCjLWEbRUdD14ELVu4AIOFEO8j4">
      <input type="hidden" name="form_id" value="search_block_form">
    </div>
  </div>
</form>

Text Content

This forum archive will soon be deleted. Please start using the new forum at
https://support.teradata.com/community. ×

 * Register
 * Log in

 * Teradata.com
 * Developer Exchange


SEARCH FORM

Search


Database

Welcome to the Teradata Forums. Read the guidelines on posting. Email
notifications and RSS feeds are available, and also a chronological list of all
forum activity.

Print
All Forums Database

johnsunnydew 43 posts Joined 09/14

07 Jan 2015
Insert Values

Hi,
I have a table called Table A which is empty. I need to add a value from one
particular column from another table.
How do i insert this and what is the syntax? Can anyone help me out as i am new
to this?




imthiyaz.sharif 3 posts Joined 08/13

07 Jan 2015

insert into databasename.tablename (table A)  ( column1) 
select column1
from databasename.tablename ( table b) ;




johnsunnydew 43 posts Joined 09/14

07 Jan 2015

Hi,
That fails..It says the first column in the Table A needs a value and caannot be
NULL




imthiyaz.sharif 3 posts Joined 08/13

07 Jan 2015

show your table a structure




johnsunnydew 43 posts Joined 09/14

07 Jan 2015

CREATE SET TABLE T1

     (

      RECORD_ID DECIMAL(27,0) NOT NULL,

      DEGREE_ZIP VARCHAR(32) CHARACTER SET LATIN CASESPECIFIC NOT NULL,

      VERSION_ID VARCHAR(32) CHARACTER SET LATIN CASESPECIFIC NOT NULL,

      ZIP_CODE VARCHAR(10) CHARACTER SET LATIN CASESPECIFIC,

      PERIOD_NAME VARCHAR(32) CHARACTER SET LATIN CASESPECIFIC,

      OPEN_KEY VARCHAR(50) CHARACTER SET LATIN CASESPECIFIC,

      START_DATE TIMESTAMP(6),

      END_DATE TIMESTAMP(6)

      

      )

      

      CREATE SET TABLE T2

     (

      KEY_ID DECIMAL(27,0) NOT NULL,

      DEGREE_ZIP VARCHAR(32) CHARACTER SET LATIN CASESPECIFIC NOT NULL,

      VERSION_ID VARCHAR(32) CHARACTER SET LATIN CASESPECIFIC NOT NULL,

      ZIP_CODE VARCHAR(10) CHARACTER SET LATIN CASESPECIFIC,

      PERIOD_NAME VARCHAR(32) CHARACTER SET LATIN CASESPECIFIC,

      OPEN_KEY VARCHAR(50) CHARACTER SET LATIN CASESPECIFIC,

      START_DATE TIMESTAMP(6),

      END_DATE TIMESTAMP(6)

      )

 

I need to insert the value of ZIP_CODE  from Table T2 to T1




imthiyaz.sharif 3 posts Joined 08/13

08 Jan 2015

Two tables looks same and you want to insert only zip_code alone from table t2
into t1. But table t1 contains not null columns.
If you try to do as what i said earlier it tries to keep nulls in all columns of
table1 except zip_code.
So as per table1 definition u cant add a row with null values in
record_id,degree_zip,version_id.
so try doing
insert into table1 ( record_id,degree_zip,version_id)
select key_id,degree_zip,version_id from table2;
 



You must sign in to leave a comment.
Active Posters
4628 posts dnoeth 1246 posts Raja_KT 1234 posts feinholz 1096 posts Fred 816
posts ulrich 773 posts Adeel Chaudhry 594 posts tomnolan 553 posts fgrimmer 544
posts M.Saeed Khurram 512 posts CarlosAL


Also of Interest
 * Data Science Trends
 * Data Trends and Insights
 * Data Management Trends

Contact Us | Privacy Policy | Terms of Use | Tracking Consent | Send Feedback |
Teradata.com
Copyright © 2004-2015 Teradata Corporation. Your use of this Teradata website is
governed by the Privacy Policy and the Terms of Use, including your
rights to materials on this website, the rights you grant to your submissions to
this website, and your responsibilities regarding your conduct on this website.
The Privacy Policy and Terms of Use for this Teradata website changed effective
April 13, 2015.



YOU DETERMINE YOUR EXPERIENCE

As a data and analytics leader, Teradata will only collect, use, and track your
personal data on our web properties when we have your permission. We want you to
fully understand and have complete control over how your personal data is used
by Teradata.


BENEFITS OF SHARING YOUR DATA WITH US

Your personal data allows us to create a better online experience for you
because it lets us tailor digital content to fit your needs and interests—Which
products do you use? Which industry are you in? Learning these things helps us
provide you with the most useful information.


WHAT CHOICES DO I HAVE?

Your privacy is important to us, and your personal information is always handled
in accordance with the Teradata Global Privacy Policy, which also explains our
use of cookies and other technical means to optimize your site experience. By
selecting one of the options below, you control your experience with Teradata
web properties and acknowledge our tracking of your online behavior.


PERSONALIZE MY ONLINE EXPERIENCE

You want a website that makes your life easier and content that is specific to
your needs. Our goal is to deliver that. Your data allows our systems to
remember what's important to you, so we can deliver content you want most, and
save you time, effort, and frustration (we're nothing if not considerate). And,
it can't be said enough: your privacy is important to us.


DON'T PERSONALIZE MY ONLINE EXPERIENCE

If you're content to have a less dynamic, non-personalized online experience
with us, you can do it. Our Global Privacy Policy still applies, but because we
don't use your information to personalize your experience on our web properties,
you might spend more time looking for what you need.


WHAT IF I CHANGE MY MIND?

If you want to personalize your privacy settings in the future, click the
"Tracking Consent" option in the footer.

Submit