how to copy TEXT fields from one table to another ????????????

how to copy TEXT fields from one table to another ????????????

Post by Minicoope » Wed, 16 Jun 1999 04:00:00



Hi,

I need to find a way to copy a TEXT field out of one table to another
without any programming, just SQL.

for example :

table X ( x1 numeric, x2 text )
table Y ( y1 numeric, y2 text )

the value of x2 needs to be copied to y1 where x1 = 1 and y2 = 3

(I find it very difficult because you can't include a text field in a
subquery, you can't store the text in a variable of a stored procedure what
can you do ?????????????,)


 
 
 

how to copy TEXT fields from one table to another ????????????

Post by Bret Halfor » Wed, 16 Jun 1999 04:00:00



> Hi,

> I need to find a way to copy a TEXT field out of one table to another
> without any programming, just SQL.

> for example :

> table X ( x1 numeric, x2 text )
> table Y ( y1 numeric, y2 text )

> the value of x2 needs to be copied to y1 where x1 = 1 and y2 = 3

> (I find it very difficult because you can't include a text field in a
> subquery, you can't store the text in a variable of a stored procedure what
> can you do ?????????????,)

I assume you have accidently switched y1 and y2 above.

How about:

update Y
set y2 = x2
from X, Y
where x.x1 = 1
and y.y2 = 4
--
Bret Halford
Sybase Technical Support                        
3665 Discovery Drive            
Boulder, CO 80303

 
 
 

how to copy TEXT fields from one table to another ????????????

Post by Bret Halfor » Wed, 16 Jun 1999 04:00:00




> > I need to find a way to copy a TEXT field out of one table to another
> > without any programming, just SQL.

> > for example :

> > table X ( x1 numeric, x2 text )
> > table Y ( y1 numeric, y2 text )

> > the value of x2 needs to be copied to y1 where x1 = 1 and y2 = 3

> I assume you have accidently switched y1 and y2 above.

> How about:

> update Y
> set y2 = x2
> from X, Y
> where x.x1 = 1
> and y.y2 = 4

Now you've got me doing it.  :-)

The last line above should, of course, be

"and y.y1 = 3" instead of "and y.y2 = 4"

--
Bret Halford
Sybase Technical Support                        
3665 Discovery Drive            
Boulder, CO 80303