SQL Server Interview Questions and Answers
<< Previous Question Next Question >>
 Question: 910 Page Views: 

Is there any difference between STUFF and REPLACE function?Explain



Posted By: Avi Date: 1 October 2010 12:13:08 PM
 Answer:

Yes, REPLACE and STUFF are different functions. STUFF:- STUFF overwrites the specific length of characters as mentioned by the "lengthOfReplace" characters. Syntax:- STUFF (String, Start, LengthofReplaceChar, ReplaceString) String - String to be overwritten StartPos - Starting Position from where overwriting will start LengthofReplaceChar - Length of string to be replaced ReplaceString - String which is to be overwritten REPLACE:- It replaces the asked particular string with the new specified string. Syntax:- REPLACE (String, StringToReplace,StringTobeReplaced) String - Input String StringToReplace - The portion of string which is to be replaced StringTobeReplaced - The new String which will replace the specified string.


Posted By: avibtech


Date: 1 October 2010 12:13:08 PM
Post a better Answer if you have
 
(Will show your Gravatar icon)  
  Country flag

Loading
Enter the text as shown in the image ruPO4s
Related Questions
SQL Server : What do you mean by Heap Table?

What do you mean by Heap Table?

These are the tables without clustered Indexes and possses one row in sys.partitions with index_id=....
Category: SQL Server Date: 10/1/2010 12:23:08 PM
SQL Server : What is the maximum number of tables and views allowed in a FROM Clause?

What is the maximum number of tables and views allowed in a FROM Clause?

It has been ristricted to maximum of 16 tables and views.
Category: SQL Server Date: 10/1/2010 12:22:08 PM
SQL Server : How many conditions can be included under WHERE Clause in SELECT statement?

How many conditions can be included under WHERE Clause in SELECT statement?

No limit specified.
Category: SQL Server Date: 10/1/2010 12:21:08 PM
SQL Server : Are "" , 0, NULL one and the same thing in SQL Server?

Are "" , 0, NULL one and the same thing in SQL Server?

No, all the three are treated diffrently. "":- means empty string 0:- represents 0 value N....
Category: SQL Server Date: 10/1/2010 12:20:08 PM
SQL Server : Write a query to select first 20 rows from a table having 100 rows?

Write a query to select first 20 rows from a table having 100 rows?

Select top 20 from table_name or Select * from table_name where count(*) <=20
Category: SQL Server Date: 10/1/2010 12:19:08 PM