Garry Shape
asked on
SQL Management Studio 2012 - replacing carriage returns
I'm running into the issue with a SQL user where data copied from the SQL Management Studio 2012 query results tab and then pasted into Excel results in a bunch of carriage return lines and messes up the paste in Excel.
The "Comments" column in particular has this problem with carriage returns.
Where should the statement in SQL go to get rid of the carriage returns to result in a single-line of text paste to Excel when copied from SQL Management Studio query Results tab?
The "Comments" column in particular has this problem with carriage returns.
Where should the statement in SQL go to get rid of the carriage returns to result in a single-line of text paste to Excel when copied from SQL Management Studio query Results tab?
select
AssetID,
Category,
EnteredBy,
REPLACE(Text,'"',' ') As Comment,
REPLACE(text, CHAR(13) + CHAR(10), ', '),
Number As CommentNumber,
Max(Date) As CommentDate,
de.NAME_SLS_SPCLST,
de.NAME_SLS_SPCLST_MGR,
de.NAME_RPR_SPCLST,
de.STGY_VAL,
DE.DII,
DE.FLAG_CMPLX_TTL_ACTIVE,
DE.DT_FST_STR_APPRD
--COUNT(Text) As DubCheckByCommentDate
From client.hsc.Comments as C
Left Join
ckuebt.dbo.ImportData_LastImport de
--client.dbo.Inventory de
ON
c.AssetID = de.ID_AST
Where
--Importid = 8224 AND
Category like 'Iam%'
AND
c.Date =
(Select
MAX(Date)
From client.hsc.Comments
Where Category like 'Iam%'
and
AssetID = c.AssetID
Group By AssetID
)
--and
--AssetID = 662438
and
Number = (Select
MAX(Number)from client.hsc.Comments
where Category like 'Iam%'
and AssetID = c.AssetID
group by AssetID
)
and
AssetID IN (
675206,
692788,
710061,
779368,
1102107
)
Group By AssetID, Category, EnteredBy, text,Number,de.NAME_SLS_SPCLST,
de.NAME_SLS_SPCLST_MGR,
de.NAME_RPR_SPCLST,
de.STGY_VAL,
DE.DII,
DE.FLAG_CMPLX_TTL_ACTIVE,
DE.DT_FST_STR_APPRD
Order By AssetID
----------------------second filter pull-----------------------------------
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER