What is the use of Stuff function in Sql Server?

 Posted by vishalneeraj-24503 on 1/29/2014 | Category: Sql Server Interview questions | Views: 1383 | Points: 40
Answer:

Stuff function is also a String function which works exactly same as Replace function except for searching any value from specified string.It replaces portion of the string in a specified string.

Syntax:
Stuff(expression_value1,start_position,string_length,expression_value2);


Where:
expression_value1: Is our any string a string from which portion of characters will be replaced.It can be a constant,variable,or column of either character or binary data.

string_length: Is a Numeric value that specifies starting index to replace characters from expression_value1.If we specify negative value or greater than the expression_value1 string then Stuff function returns null value.

string_length: Is also a Numeric Value which specifies number of characters to be replaced from expression_value1.If negative value is specified as length,then stuff function returns null value.

expression_value2: Is a new string to be changed from expression_value1.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Posted by: Deepak.Samala on: 3/14/2014 | Points: 10
Appreciate for your questions but need to give with the examples also as virtual interview questions,that will be so help full to us

Login to post response