create inserts on table data
Teradata Teradata Discussion Forums Teradata.com Discussion Forum
Visit Teradata.com
Home       Guidelines    Member List
Welcome Guest ( Login | Register )
        


This online forum is for user-to-user discussions of Teradata products, and is not an official customer support channel for Teradata. If you require direct assistance, please contact Teradata support.


create inserts on table data Expand / Collapse
Author
Message
Posted 10/20/2009 7:06:52 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 10/27/2009 4:24:42 AM
Posts: 2, Visits: 10
Hi!

Can you help me?
I need to create inserts on table data in order to make installation script.
I looked up in Sql Assistant, Teradata Administrator but haven't found.

it is possible to write smth on VBA or C#, but I haven't time

Thanks

Artem
Post #17108
Posted 10/20/2009 10:51:18 AM
Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Forum Members
Last Login: Yesterday @ 3:55:54 AM
Posts: 111, Visits: 263
In SQL Assistant:

create Volatile table MyOldTable
(
Col1 Smallint Not Null
, Col2 Smallint
, Col3 Char(6))
Unique primary index (col1)
On Commit Preserve Rows
;

Insert Into MyOldTable (Col1, Col2, Col3)
Values (1,1,'One')
;
Insert Into MyOldTable (Col1, Col2, Col3)
Values (2,Null,'Twobl')
;
Insert Into MyOldTable (Col1, Col2, Col3)
Values (3,3,Null)
;
Insert Into MyOldTable (Col1, Col2, Col3)
Values (4,Null,Null)
;

Select
'Insert Into MyTable
(Col1, Col2, Col3) Values ('||
Coalesce(''''||Col1||'''','Null')
||','||
Coalesce(''''||Col2||'''','Null')
||','||
Coalesce(''''||Col3||'''','Null')
||');'
From MyOldTable
Order By Col1, Col2
;

Take the results from this select and paste into the Query window.
Post #17111
Posted 10/21/2009 9:35:04 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 10/27/2009 4:24:42 AM
Posts: 2, Visits: 10
Thanks, jimm, for your replay.
I guess i described the situation not clearly.

I have to make some procedure, programm or use functionallity of some tool to make inserts on any table in Teradata. Usually, RDBMS have management tools with such functionallity.
I used PL/SQL Developer to make such inserts in Oracle (ofcourse it is 3d party tool, but it is free for use).

But I haven't found such functionality in Teradata tools.
I started to make procedure, wich would make inserts on any table.. it uses 2 parameters: database name, table name, and works with DBC.Columns to know the structure of the table.
But my knowledge of Teradata is poor.. in Oracle I would make it much faster.

Thanks.

Artem
Post #17124
Posted 10/27/2009 3:19:07 AM


Forum Guru

Forum GuruForum GuruForum GuruForum GuruForum GuruForum GuruForum GuruForum Guru

Group: Forum Members
Last Login: Yesterday @ 12:42:08 AM
Posts: 74, Visits: 32
Hi,
I am not too sure if I understood your question correctly. But one solution IF YOU ARE USING DYNAMIC inputs for Inserts in Query Assistant is:

INSERT INTO TAB A
( COL1, COL2, COL3)
SELECT (?,?,?);

When you run this query, it will prompt you to enter the values for each column dynamically. If it does not prompt you individually, it will expect a filename which means you have opted for File Import mode which is the wrong mode for single inserts.
If this is not what you were looking for, get in touch.


Strive to success.

Arun.

Post #17166
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 ( 0 guests, 0 members, 0 anonymous members )
No members currently viewing this topic.


All times are GMT -5:00, Time now is 4:23pm

Powered By InstantForum.NET v4.1.4 © 2009
Execution: 0.094. 9 queries. Compression Disabled.