我在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
答案 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