Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

Merge the three fields of table into single field without using Concatenation function in sql.

user-image
Question added by muthiah m
Date Posted: 2014/02/05
Mohammad Masadeh
by Mohammad Masadeh , SharePoint Lead Developer , Port Customs And Freezone Corporation Dubai

In oracle we do it like this  

select field1 || field2 || field3 as result from tablename;

Ex : select ' current time is '|| sysdate from dual ;

u can use this sytanx in concatenation  fieds

Deleted user
by Deleted user

Use AS

Select Field1,Field2,Field3 As filedMerge

Muhamamd Saqib
by Muhamamd Saqib , Senior Software Engineer / Technical Lead , OT EMR Inc.

Use a function with COALESCE.

 

CREATE FUNCTION [GetFieldsWithID](    @id int)RETURNS varchar(max)ASBEGIN    declare @output varchar(max)    select @output = COALESCE(@output + ', ', '') + alias    from Users    where id = @id    return @outputENDGOSELECT [id], GetFieldsWithID([id])FROM UsersGO

More Questions Like This