User Id :    Password :      New Member   Forgot Password
 
Replicate function in Sql Server
Description Replicate fucntion in Sql server repeats a string for a number of times specified by the user. For example if you want to repeat 'A' five times then just use replication function REPLICATE('A',5). It will produce 'AAAAA' as an output.   No. of Views     3541
  Rating     0
Author Najmul Hoda   Posted On     27 Sep 2011
Tags SQL SERVER    

Sample Code   Download Code

 

Replicate fucntion in Sql server repeats a string for a number of times specified by the user.

 

Syntax:

REPLICATE ( string_expression ,integer_expression )

 

Here string_expression is the string you want to repeat for  multiple times and integer_expression is the number of times you want string to be repeated.

Lets take an example and discusss.

If you want to repeat 'A' five times then just use replication function REPLICATE('A',5). It will produce 'AAAAA' as an output.

 

SELECT REPLICATE('A',5)
SELECT REPLICATE('India-',5)


OutPut
-------

AAAAA
India-India-India-India-India-

 

Hope it will help. Happy reading

 

 

About Author

About Author He is a .Net developer having 4+ years of experience. He loves writting technical article for .Net developers. Najmul Hoda
No Photo
 
Country India
Company BirlaSoft
Home Page www.dotnetlogix.com

Rate this article

Rating options from poor, fair, good, very good to excelent.  
 

Comments

     
Write your comment here.  
Comment
Verification Code   
  
    
 
Section sponsored by