hi I have two separate columns [StuName , StuLName]
in select i use like this :
Select StuName, StuLName From Tbl_Student
Result : [Mahdi], [Hosseini]
is there any way to combine this 2 columns in one column (only in select) something like this :
Select StuName + " " + StuLName From Tbl_Student
Result (for example) :
Mahdi Hosseini
StuName and StuLName are NVARCHAR
Your query ought to work. Otherwise, you can also use [CONCAT]
to string togehter two or more strings:
SELECT CONCAT('First' , ' ' , 'Last' )
Result:
First Last
More info about Concat on MSDN.
In your case, this ought to do the trick:
SELECT CONCAT(StuName, ' ',StuLName) AS StudentName FROM Tbl_Student