类型为Varchar(4000)的SQL Server列应该显示在不同的行中,其中有***见下面的示例

时间:2013-07-25 19:37:08

标签: sql-server

我在SQL Server表中有Varchar(4000)列,大字符串需要有 *

的行

字符串示例:

 *** CERPS Generated Case [06/25/2013 01:41:13 AM] C0   *** CREATED:  06/25/2013 AT 09:40 BY 0000000  AT RUHA *** CONTACT:  PHONE NUMBER 000-000-0000 X-0000 *** SPECIAL HANDLING CODE: 02 DELIVER WEEKDAY STATUS CODE: 33-VENDOR TRANSPORTATION DELAY MISSING SHIPT/ NOT LOCATED MISSING SHIPTS/ NOT LOCATED 

这需要显示为

*** CERPS Generated Case [06/25/2013 01:41:13 AM] C0
*** CREATED:  06/25/2013 AT 09:40 BY 0000000  AT RUHA
 *** CONTACT:  PHONE NUMBER 000-000-0000 X-0000
*** SPECIAL HANDLING CODE: 02 DELIVER WEEKDAY STATUS CODE: 33-VENDOR TRANSPORTATION DELAY MISSING SHIPT/ NOT LOCATED MISSING SHIPTS/ NOT LOCATED 

1 个答案:

答案 0 :(得分:4)

我真的不明白这个的目的,但我想如果你想在SSMS上做这个,这是一个查询:

declare @strPrint Varchar(2000)
select @strPrint=replace('*** CERPS Generated Case [06/25/2013 01:41:13 AM] C0   *** CREATED:  06/25/2013 AT 09:40 BY 0000000  AT RUHA *** CONTACT:  PHONE NUMBER 000-000-0000 X-0000 *** SPECIAL HANDLING CODE: 02 DELIVER WEEKDAY STATUS CODE: 33-VENDOR TRANSPORTATION DELAY MISSING SHIPT/ NOT LOCATED MISSING SHIPTS/ NOT LOCATED',
'***',char(10)+'***')
Print @strPrint