以指定的次数重复字符串值。 返回类型:返回与 string_expression 相同的类型。 REPLICATE ( string_expression ,integer_expression ) 例子: USE AdventureWorks2012; GO SELECT [Name] , REPLICATE('0', 4) + [ProductLine] AS 'Line Code' FROM [Production].[Product] WHERE [ProductLine] = 'T' ORDER BY [Name]; GO
SELECT REPLICATE('test\', 3)
SELECT REPLICATE('test\', 3)
返回类型:返回与 string_expression 相同的类型。
REPLICATE ( string_expression ,integer_expression )
例子:
USE AdventureWorks2012;
GO
SELECT [Name]
, REPLICATE('0', 4) + [ProductLine] AS 'Line Code'
FROM [Production].[Product]
WHERE [ProductLine] = 'T'
ORDER BY [Name];
GO
REPLICATE(str,count)
返回由重复count次的字符串str组成的一个字符串。如果count <= 0,返回一个空字符串。如果str或count是NULL,返回NULL。http://technet.microsoft.com/zh-tw/library/ms174383
语法:REPLICATE ( string_expression ,integer_expression )
-->测试查询
select REPLICATE('1',4)
/*
1111
*/
select REPLICATE('a',4)---------------------------
/*
aaaa
*/