copying from table to table

I would like to copy the contents of one column in a table to another 
table.  However, the first column of type double while the column it is 
being copied to is a varchar. 

Any ideas?
0
Ren
7/17/2002 10:08:10 PM
sybase.powerbuilder.general 62418 articles. 19 followers. Follow

8 Replies
896 Views

Similar Articles

[PageSpeed] 5
Get it on Google Play
Get it on Apple App Store

     Let's talk about the ideal situation.  If the first table is 1 column 
and you can just blatently update the other table with the value, create a 
pipeline from the numberic table/column to the character table/column.  Go 
to the SQL pane and change the

SELECT "number_table"."anum"
      FROM "number_table" 

To 
SELECT string("number_table"."anum"  )      FROM "number_table" 

     If you have more of a complication than that, maybe this numeric must 
go into certain rows as a string, create two datawindows, the first 
retrieves the table with the numeric, the second just connects to the 
character based table.  After retrieveing the numeric table create a 
command button to go something like:

Long ll_row, ll_newrow
For ll_row = 1 to dw_numeric.rowcount()
   ll_newrow = dw_character.insertrow(0)
 
dw_character.SetItem(ll_newRow,'A_CHAR',String(dw_numeric.GetItemnumber(ll_row,'A_NUM'))
Next
dw_character.Update()

- Joe Slawsky (NOSPAMFORME_jslawsky@planetdx.com)
www.planetdx.com
0
Joe_Slawsky
7/17/2002 10:23:43 PM
I think you can do with Pipeline object. You can modify the datasource and
wrap the column of type double with string conversion function.

What database are you using ?. You may need to find string conversion
function for the particular database.

-Raj



<Ren> wrote in message
news:8B74C649BA438435007998DA85256BF9.0079991285256BF9@webforums...
> I would like to copy the contents of one column in a table to another
> table.  However, the first column of type double while the column it is
> being copied to is a varchar.
>
> Any ideas?


0
PUNNIARAJ
7/17/2002 10:24:00 PM
Sure.  Look up the String PowerScript function in the PB help file.

Get the double from the first table, use the above function to convert 
it to a string, and copy it to the second table.  Many ways to do the 
copying, but it comes down to using the String PowerScript function to 
convert it from a numeric to string datatype.

:: m a r t y


In article <8B74C649BA438435007998DA85256BF9.0079991285256BF9
@webforums>, Ren <Ren> says...
> I would like to copy the contents of one column in a table to another 
> table.  However, the first column of type double while the column it is 
> being copied to is a varchar. 
> 
> Any ideas?
> 
0
Martin
7/17/2002 10:25:47 PM
I'm not sure which method you are enquire, anyway I provide the easy way
that using SQL Stament.

INSERT INTO target_table(colstr1, colstr2... )
    SELECT String(s.colnum1), s.colstrA ..
    FROM source_table s

Good Luck

<Ren> wrote in message
news:8B74C649BA438435007998DA85256BF9.0079991285256BF9@webforums...
> I would like to copy the contents of one column in a table to another
> table.  However, the first column of type double while the column it is
> being copied to is a varchar.
>
> Any ideas?


0
C
7/18/2002 6:27:14 AM
You can use object u_table (available as second item at
http://www.clutilities.com), which can modify column type and convert stored
data to new type.

Adam

<Ren> p�se v diskusn�m
p��sp�vku:8B74C649BA438435007998DA85256BF9.0079991285256BF9@webforums...
> I would like to copy the contents of one column in a table to another
> table.  However, the first column of type double while the column it is
> being copied to is a varchar.
>
> Any ideas?


0
abi
7/18/2002 8:16:27 AM
okay, I'm trying the script below but its not working for me....eventually 
I want to feed it a list of several thousand orderno's, but this is to test 
one to get it working...

INSERT INTO table1(col1)
SELECT String(col1)
FROM table2
WHERE (table1.index_id = table2.oe_line_idx)
table2.orderno = 213212;

I'm using a Sybase database.
thanks,
Ren.
0
Ren
7/18/2002 11:39:43 AM
Try this.

INSERT INTO table1(col1)
SELECT Convert(varchar(255),col1)
FROM table2
WHERE (table1.index_id = table2.oe_line_idx)
table2.orderno = 213212


<Ren> wrote in message
news:FAB695C38DD7E85100400FD785256BFA.0029345985256BFA@webforums...
> okay, I'm trying the script below but its not working for me....eventually
> I want to feed it a list of several thousand orderno's, but this is to
test
> one to get it working...
>
> INSERT INTO table1(col1)
> SELECT String(col1)
> FROM table2
> WHERE (table1.index_id = table2.oe_line_idx)
> table2.orderno = 213212;
>
> I'm using a Sybase database.
> thanks,
> Ren.


0
Jeinutheen
7/18/2002 3:09:11 PM
Sorry, I'm not really get your question. Anyway, I try my best to
understand, hope this is the answer for you.

INSERT INTO table1( col1)
    SELECT String(col1)
    FROM table2
    WHERE table2.orderno = 213212
    AND table2.oe_line_idx IN (SELECT index_id FROM table1);

Good Luck.

<Ren> wrote in message
news:FAB695C38DD7E85100400FD785256BFA.0029345985256BFA@webforums...
> okay, I'm trying the script below but its not working for me....eventually
> I want to feed it a list of several thousand orderno's, but this is to
test
> one to get it working...
>
> INSERT INTO table1(col1)
> SELECT String(col1)
> FROM table2
> WHERE (table1.index_id = table2.oe_line_idx)
> table2.orderno = 213212;
>
> I'm using a Sybase database.
> thanks,
> Ren.


0
C
7/19/2002 4:31:46 AM
Reply:

Similar Artilces:

From Table to Table
I am working in Delphi 4 and ran into a roadblock I am unfamiliar with. I am trying to search and find values in one table based off of matching values in another. For example a table of objects with fields like name, description, type, ect; and a table of object properties in which each object can be represented multiple times based on the settings on the page at the time. So if i search the object property table (and eventually loop through to repeat for all objects) to find all cases of visible objects when a certain criteria is met. It stops on the first object with "Yes" in th...

Tables?! Why Tables?!
Bit random...but why does everything have to be rendered as a table?  It's starting to get quite annoying.  Formview - does this need to be a table?  the Menu??  Wouldn't it make sense to allow the option to...say...not render a Menu as a table?  Am I the only one that thinks this or are there others?  www.internetgeeks.co.ukwww.norwichbookclub.co.uk You can use CSS Adapters to create your own adapters to override how the controls render it self. In the next version of ASP.Net, you will probably have more flexibility to specify the surrounding elements of th...

Reverse Engineer created copies of table (table:1, table:2)... How do I merge them back into 1 table?
PowerDesigner 12.1 I just reverse-engineered about 20 tables from our database, and it took one of my key tables and created two copies ("TableName : 1" and "TableName : 2"). I'm sure the engine was trying to make the diagram easier for it to auto-layout, but I want all the FKs and such from one table). How do I merge them back into just one table? Thanks, Jason Jason Vogel wrote: > PowerDesigner 12.1 > > I just reverse-engineered about 20 tables from our database, and it took > one of my key tables and created two copies ("Tabl...

stored procedure to copy table 1 to table 2 appending the data to table 2.
Just wondering if there is an easy transact statement to copy table 1 to table 2, appending the data in table 2.with SQL2000, thanks.Paul GSoftware Engineer Appending the rows, or the columns? Append rows: Insert into table2SELECT * FROM table1 Append columns: UPDATE Table2SET t2.col1=t1.col1+t2.col1, t2.col2=t1.col2+t2.col2, etcFROM Table2 t2JOIN Table1 t1 ON (t1.yourkeyhere=t2.yourkeyhere) Not sure how useful the second append is, and it'd be really odd to actually want to do that, but you can, if you ever really needed to ;p ok thanks, just need to append the rows.  Lo...

How do you copy table data to another table?
I need to copy existing row data from one table into a new row in a different table, both in the same database.  Can this be done in a stored procedure where the selected row is passed in as parameter value? Thank you, There's plenty of ways you can do this.Try INSERT INTO YourTable (.column list) SELECT (columnlist) FROM YourTable WHERE <Condition>  ***********************Dinakar NethiLife is short. Enjoy it.*********************** that easy? thank you.  I am getting that 'can't see the forest for the trees' feeling....

Copy table structure to a new table
Hello everyone, I have a local MSSQL server (I guess it's called MSDE), with some tables that I would like to use as a template for a set of new tables. I would simply like a Stored Procedure that takes these 3 tables, makes a copy of their structure (not data, since they will be empty), and name them by using a parameter given to the SP. I have made something that I thought would work, but after testing it a bit more, it seems to forget default values for the fields, which is of course not good enough :). I hope that someone can tell me how to duplicate t...

Copying data from one table to other table
Hello All, I have two tables in DB2, BNKDBF and BNKPOS. Lets call there tables A and B respectively. Table A has 11 rows and 9 fields. And Table B has zero rows and 11 fields. One thing.. there will always be 11 rows in table A. Now i want to do is that copy those 11 rows from Table A to Table B and then put data in two additional fields in all rows of Table B. Faisal insert into tableB   select * from tableAYou'll need to give more information on the additional fields if you want help with them.Nick Nick, Please can ellaborate this thing a little bit...

alter table of table A causes trigger on table B accesseng table A to fail
hi, i recently faced a strange problem, i have two tables, table A and table B table A has a update trigger which updates data in table B. i altered table B to add two more columns. after which when i updated table A(modifying 1 row), my tran log got full. there was a threshold proc which got fired but it did'nt help much. i though the tables had been corrupted. ran dbcc tablealloc on syslogs, table A, table B, no errors. Just to be sure I ran a dbcc checkdb, checkalloc and checkcatalog - no errors i recreated the trigger - no use. dropped the trigger. updated the table it ...

copy column from one table to another table
Hi, I have 2 tables. Table1 has column1 and column2. I wish to copy column1 into Table2 by using sql statement. How do i do that? Thank you. In general you'd do it like this: Insert statement: INSERT INTO Table2 ( Column1 ) SELECT Column1 FROM Table1 Update statement: UPDATE Table2 SET Column1 = T1.Column1 FROM Table2 T2 INNER JOIN Table1 T1 ON T2.someID = T1.someID TerriTerri MortonEngagement Manager, NeudesicHow to ask a question...

Copy Submission table info Display table?
I have a submission form where users enter information.  This data is written into a submission table and after reviewing and editing it I need to move the data into my DisplayInfo table.  I want to maintain the seperation of submitted data from display data.  Is there an easy way, or control that will copy the data from one table to another when the data structure is the same? Thank you no short cuts I guess. Hi ,zoltac007: There are tow approaches you can follow with, Hope it will helps you. One: DataTable dtTemp = reader.GetSchemaTable();dtSchema = ne...

First table ID copy to second table.
Help me please ! I what first table 'TOPIC' ID copy to second table 'POST'. I create basic forum for me. I make new topic file where you write topic name and another info. I hope you understad me :) I am form Latvia. I wrote some days ago new POST fail with UPDATE. I think what you are trying to do is DRI (declarative referential integrity) related in older MySQL it is not possible but if you are using the new version, try the link below to see if you can use a DRI (declarative referential integrity) Trigger. Hope this helps.http://mysql.gilfster.com/triggers/introduction.phpKind regard...

How can I copy a column from table A into table B ??
I want to add an ID column to an existing table to ease the SQL selects from it. The ID exists in another table but I have to relate several tables together to get the right one. tableA id number1 text1 -----------------------------+ | | tableB | id | number1 tableC | tableC.id ----------> id | text1 <-----+ I want to add the tableB.id column to tableA so I can do away with...

How to create a table with copying everything from an existing table
Hi, I would like to create a table that is identical to an existing table (table definitions, structures, and data itself). In Oracle, the following command will do the work: create table new_table as select * from existing_table; But in Sybase, it seems there is no such command to do the job. Is there any way to do it? Thanks for your help. There is command: select * into new_table from existing_table This will work.....go ahead Xiaobing Suo <xsuo@imake.com> wrote in message news:39BE3510.480CEEF1@imake.com... > Hi, > > I would like to create a table t...

Copy all data from MSSQL tables to Access table
I want to copy all data and tables from my mssql database to a new access database. Is this possible?Cheers,Curt.Regards, Curt...

Web resources about - copying from table to table - sybase.powerbuilder.general

Private copying levy - Wikipedia, the free encyclopedia
A private copying levy (also known as blank media tax or levy ) is a government -mandated scheme in which a special tax or levy (additional to ...

Zynga CEO Dispels Facebook Game Copying Accusations
... they are like the crew mechanic in our games. They give you a new way to interact with your friends. Zynga was also accused last week of copying ...

Showing Apple employee #8 some of my artifacts. He remembers manually copying the Star Wars cassettes ...
jurvetson posted a photo: He has a rig that fed eight recoding tape drives from one master, and he would manually copy eight tapes at a time ...

The Secret Pattern That Stops You Copying Bank Notes - YouTube
http://tomscott.com - @tomscott - There's a hidden pattern on banknotes, all around the world, that means photocopiers refuse to copy them.

CSAIL fixes software bugs automatically, in any language, by copying from safer applications
A new system can repair bugs in software using smart processing that imports functionality from other programs, all without access to source ...

Australia risks copying US 'ag-gag' laws to turn animal activists into terrorists
When Amy Meyer saw a sick cow being pushed by a bulldozer outside a slaughterhouse, she did what any of us would in this age of iPhones and Instagram ...

Hardware vendors sue Dutch government over copyright levies - regulation, legal, Dutch Home Copying Foundation ...
... on hard disks, smartphones, tablets and MP3 players that are meant to compensate the music and movie industries for losses caused by home copying. ...

Grace Jones slams Lady Gaga for copying her, describes her as soulless - The Courier-Mail Search Search ...
GRACE Jones has slammed Lady Gaga in a new interview, saying she didn’t “feel a soul” when she met the controversial pop star.

Iran claims to be copying US drone
CTV.ca Iran claims to be copying US drone Herald Sun AN IRANIAN military commander said the country is building a copy of a US spy drone captured ...

Ex-cop pleads guilty to copying sex video
A former officer has pleaded guilty to copying a private sex video he found on the mobile phone of a victim who came to police for help last ...

Resources last updated: 12/3/2015 3:09:20 PM