REPLICATE() Function in SQL Server Last Updated : 30 Dec, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report REPLICATE() function : This function in SQL Server is used to repeat the specified string for a given number of times. Features : This function is used to return the stated string for a given number of times. This function accepts only strings and integers as parameter. This function returns an error if the second parameter is not provided. The repeated strings returned here has no space in between the former and the latter string. Syntax : REPLICATE(string, integer) Parameter : This method accepts two parameter as given below : string : Specified string to repeat. integer : Specified number of times for which the string is to be repeated. Returns : It returns the stated string for a specified number of times. Example-1 : Getting the stated string for a specified number of times. SELECT REPLICATE('Geeks for Geeks ', 2); Output : Geeks for Geeks Geeks for Geeks Example-2 : Using REPLICATE() function with a variable and getting the repeated strings for the specified number of times. DECLARE @string VARCHAR(4); SET @string = '123 '; SELECT REPLICATE(@string, 4); Output : 123 123 123 123 Example-3 : Using REPLICATE() function with two variables and getting the repeated strings for the specified number of times. DECLARE @string VARCHAR(6); DECLARE @int INT; SET @string = 'Geeks '; SET @int = 5; SELECT REPLICATE(@string, @int); Output : Geeks Geeks Geeks Geeks Geeks Example-4 : Getting the stated string for a specified number of times which is a float value. SELECT REPLICATE('gfg ', 5.9); Output : gfg gfg gfg gfg gfg Application : This function is used to repeat the specified string for a stated number of times. Comment More infoAdvertise with us Next Article RANK() Function in SQL Server N nidhi1352singh Follow Improve Article Tags : SQL DBMS-SQL SQL-Server Similar Reads RANK() Function in SQL Server The RANK() function is a powerful window function in SQL Server used to assign a rank to each row within a result set. It is particularly useful when we need to assign a rank to a group of rows based on some sorting criteria and want to differentiate between rows that have the same values. Unlike ot 5 min read REVERSE() Function in SQL Server The REVERSE() function in SQL Server is a simple and powerful tool designed to reverse the order of characters in a string. By taking a string input, it returns a new string with its characters arranged in the opposite sequence. In this article, We will learn to REVERSE() Functions in SQL Server by 3 min read LOG() Function in SQL Server The LOG() function returns the logarithm of a specified number or the logarithm of the number to the specified base. Syntax : LOG(number, base) Parameter : LOG() function accepts two-parameters as mentioned above and described below. number - This parameter hold a number which is greater than 0. bas 1 min read LTRIM() Function in SQL Server The LTRIM() function in SQL Server removes all the space characters found on the left-hand side of the string. It removes the leading spaces from a string, SyntaxThe LTRIM function for SQL Server syntax is: LTRIM(string, [trim_string]) Parameter: string - The string from which the leading space char 2 min read MIN() Function in SQL Server MIN() : This function in SQL Server is used to find the value that is minimum in the group of values stated. Features : This function is used to find the minimum value.This function comes under Numeric Functions.This function accepts only one parameter namely expression. Syntax : MIN(expression) Par 2 min read NCHAR() Function in SQL Server NCHAR() function : This function in SQL Server is used to return the Unicode character that is based on the number code. For example, if the specified number is 65 then this function will return A. Features : This function is used to find the Unicode character of a given number. This function accept 2 min read Like