Tuesday, 29 November 2016

First Name + Middle Name + Last Name Merge With One Extra Space

  1. Create FUNCTION [dbo].[GetFullNameWithNoSpace]                      
  2. (                      
  3.   @First_Name varchar(50),                      
  4.   @Middle_Name varchar(50),   
  5.   @Last_Name varchar(50)  
  6. )                      
  7. RETURNS Varchar(152)                      
  8. AS                      
  9. begin                      
  10. Declare @outTime Varchar(152);                  
  11.  SELECT @outTime= REPLACE(RTRIM(COALESCE(@First_Name + ' ''') +  
  12.                      COALESCE(@Middle_Name + ' ''') +  
  13.                      COALESCE(@Last_Name+ ' ''')  ), '  '' ')  
  14.                        
  15.                                          
  16.  RETURN  @outTime                      
  17. END  
  18. GO 
  19. SELECT dbo.[GetFullNameWithNoSpace]('ashish','','Srivastava')  

No comments:

Post a Comment

Upload valid file in C#

    protected bool CheckFileExtandLength(HttpPostedFile HtmlDocFile)     {         try         {             Dictionary<string, byte[]>...