April 14, 2014 at 3:20 am
Hi All,
How to update column with multiline coments.
eg. I need to update Notification column in my table as below.
Exit Formalities Notification sent to:
Employee: LastName, FirstName
EmployeeEmail: EmployeeEmailAddress
Is it possibe?
Please give an ideas.
Thanks
Abhas.
April 14, 2014 at 3:40 am
abhas (4/14/2014)
Hi All,How to update column with multiline coments.
Add "carriage return" and "line feed" characters, see the example
😎
SELECT 'THIS IS A COMMENT LINE 1' + CHAR(13) + CHAR(10) + 'THIS IS LINE 2'
Output
----------------------------------------
THIS IS A COMMENT LINE 1
THIS IS LINE 2
April 14, 2014 at 3:41 am
It can be done but I'm not entirely sure what you want. Are the LastName, FirstName and EmployeeEmailAddress' coming from a query? Can you give us a bit more information about what you want please? For example do you want to do this in SSRS or as part of a query?
How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537
April 14, 2014 at 3:53 am
While executing following script please see results to text...And I used '*' considering you don't have one in the field where you want to do it ... But I believe there has to be a easy way out too
DECLARE @tab TABLE
(
COMMENT VARCHAR(100)
)
INSERT INTO @tab(COMMENT)
SELECT 'Exit Formalities Notification sent to:' UNION ALL
SELECT 'Employee: LastName, FirstName' UNION ALL
SELECT 'EmployeeEmail: EmployeeEmailAddress'
DECLARE @COMM VARCHAR(1000)
SELECT @COMM = REPLACE(STUFF((SELECT '*' + COMMENT FROM @tab
FOR XML PATH ('')),1,1,''),'*',CHAR(13))
SELECT @COMM
April 14, 2014 at 4:03 am
Thanks friends,
Employee: @LastName, @FirstName
EmpEmail: @StudentEmailAddress
The above values are coming from query.
Thanks
Abhas.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply