Monday, 7 April 2014

Repeats a string value a specified number of times in sql server

REPLICATE ( string_expression ,integer_expression ) 

select-select rtrim(Columns Name) +REPLICATE(' ',Total Length- LEN( rtrim(Columns Name)))+'1' 
from tblMstVFAMem where len(Columns Name)>0 and Columns Name is not null

update-update TableName  set Assets_F= rtrim(Columns Name) +REPLICATE(' ',Total Length- LEN( rtrim(Columns Name)))+'1' 
 where len(ColumnsName)>0 and ColumnsName is not null

No comments:

Post a Comment

How to highlight selected text in notepad++

  –> To highlight a block of code in Notepad++, please do the following steps step-1  :- Select the required text. step-2  :- Right click...