Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 problem select

Author  Topic 

pascal_jimi
Posting Yak Master

167 Posts

Posted - 2013-10-23 : 02:16:40
hi


declare @a1 table
(
id int not null identity(1,1),
name char(30),
phone int,
adress char(30)
)

insert into @a1
(name,phone,adress)
values
('john travolta',1,'New Jersy N20 ')
select*from @a1

id name phone adress
1 john travolta 1 New Jersy N20


how i get result so

id name+adress phone


1 john travolta New Jersy N20 1

http://sql-az.tr.gg/

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-10-23 : 02:24:28
[code]
SELECT id,
name + COALESCE(' ' + adress,''),
phone
from @a1
[/code]

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

pascal_jimi
Posting Yak Master

167 Posts

Posted - 2013-10-23 : 02:25:48
thank you very much visakh

http://sql-az.tr.gg/
Go to Top of Page

VeeranjaneyuluAnnapureddy
Posting Yak Master

169 Posts

Posted - 2013-10-23 : 02:32:16
Select Id,Cast(Name as Varchar(15))+Cast( Adress AS Varchar(30)),Phone From @a1

veeranjaneyulu
Go to Top of Page

pascal_jimi
Posting Yak Master

167 Posts

Posted - 2013-10-23 : 02:36:20
thank you VeeranjaneyuluAnnapureddy

http://sql-az.tr.gg/
Go to Top of Page
   

- Advertisement -