November 30, 2009 at 4:32 am
I have 4 columns in sql server
Name Class RollNo Section
I want to get the concantenated value of these columns in one column in the address printable form as we are printing address on some envelope:
Name
Class
RollNo
Section
Any body please help
November 30, 2009 at 4:45 am
You mean this?
DEclare @name varchar(10),
@Class varchar(10),
@rNo int,
@Section varchar(10),
@Address varchar(50)
SET @NAME = 'Gaurav'
SET @Class = 'Tenth'
SET @rNo = 100
SET @Section = 'A'
SET @Address = @name + char(13) + @Class + char(13) + convert(varchar(10),@rNo)
+ char(13) + @Section
PRINT @Address
---------------------------------------------------------------------------------
November 30, 2009 at 9:12 am
do you mean for all rows? If so, you can do a SELECT and use the + operator to concatenate fields.
SELECT name + CHAR(13) + class + CHAR(13) + rollno ...
from MyTable
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply