Hi,
This might be a simple one .. I have a table with two fields (There are more
but Ill concentrate on this ones).
One field is 'address', the other is 'address2', both are nvarchar
If I want to select both into another table but 'concatenate them' how can I
do this ?
At the moment this is what I have
Select address, address2
into table2
from table1
How can I have something like
Select address + address2 as BIGaddress
into table2
from table1
AleksYour statement seems to be ok...or I haven't understood your question...
Select address + address2 as BIGaddress
into table2
from table1
Francesco Anti
"Aleks" <arkark2004@.hotmail.com> wrote in message
news:%23vZHbeDbFHA.3328@.TK2MSFTNGP10.phx.gbl...
> Hi,
> This might be a simple one .. I have a table with two fields (There are
> more but Ill concentrate on this ones).
> One field is 'address', the other is 'address2', both are nvarchar
> If I want to select both into another table but 'concatenate them' how can
> I do this ?
> At the moment this is what I have
> Select address, address2
> into table2
> from table1
> How can I have something like
> Select address + address2 as BIGaddress
> into table2
> from table1
> Aleks
>|||What you have should work fine
Select address + address2 as BIGaddress
into table2
from table1
The SELECT INTO will create a new table called table2 with one column called
BIGaddress
If table2 already exists then change the SELECT INTO into an INSERT
"Aleks" <arkark2004@.hotmail.com> wrote in message
news:#vZHbeDbFHA.3328@.TK2MSFTNGP10.phx.gbl...
> Hi,
> This might be a simple one .. I have a table with two fields (There are
more
> but Ill concentrate on this ones).
> One field is 'address', the other is 'address2', both are nvarchar
> If I want to select both into another table but 'concatenate them' how can
I
> do this ?
> At the moment this is what I have
> Select address, address2
> into table2
> from table1
> How can I have something like
> Select address + address2 as BIGaddress
> into table2
> from table1
> Aleks
>|||The query which you have given will work Right ?
Regards,
Peri
"Aleks" <arkark2004@.hotmail.com> wrote in message
news:#vZHbeDbFHA.3328@.TK2MSFTNGP10.phx.gbl...
> Hi,
> This might be a simple one .. I have a table with two fields (There are
more
> but Ill concentrate on this ones).
> One field is 'address', the other is 'address2', both are nvarchar
> If I want to select both into another table but 'concatenate them' how can
I
> do this ?
> At the moment this is what I have
> Select address, address2
> into table2
> from table1
> How can I have something like
> Select address + address2 as BIGaddress
> into table2
> from table1
> Aleks
>|||Just watch out for two things:
1. If either address or address2 is NULL, the concatenation will be NULL.
You can use this instead: coalesce(address,N'') + coalesce(address2,N'')
2. If address+address2 exceeds 4000 characters, you will lose information.
Steve Kass
Drew University
Aleks wrote:
>Hi,
>This might be a simple one .. I have a table with two fields (There are mor
e
>but Ill concentrate on this ones).
>One field is 'address', the other is 'address2', both are nvarchar
>If I want to select both into another table but 'concatenate them' how can
I
>do this ?
>At the moment this is what I have
>Select address, address2
>into table2
>from table1
>How can I have something like
>Select address + address2 as BIGaddress
>into table2
>from table1
>Aleks
>
>|||Jaja .. I didnt even tested and worked fine ... how silly
A
"Steve Kass" <skass@.drew.edu> wrote in message
news:u27rGxDbFHA.2440@.TK2MSFTNGP10.phx.gbl...
> Just watch out for two things:
> 1. If either address or address2 is NULL, the concatenation will be NULL.
> You can use this instead: coalesce(address,N'') + coalesce(address2,N'')
> 2. If address+address2 exceeds 4000 characters, you will lose information.
> Steve Kass
> Drew University
>
> Aleks wrote:
>
No comments:
Post a Comment