Add/Remove NewLine in SQL Query

Posted By Venu Thomas

Add NewLine in SQL Query:

 
  Code:
Declare @FristName Char(10)
Declare @LastName Char(10) 
 
Set @FristName = 'Venu'
Set @LastName = 'Thomas' 
 
Select (@FristName + CHAR(13) + CHAR(10)+ @LastName) As Name
   

OutPut:

Name  
———————- 
Venu      
Thomas    

(1 row(s) affected)
 

Remove NewLine in SQL Query:

Code:


Declare @FristName Char(5)
Declare @LastName Char(10) 
Declare @strName Char(15) 
 
Set @FristName = 'Venu'
Set @LastName = 'Thomas'  
 
Set @strName =@FristName + CHAR(13) + CHAR(10)+ @LastName 
 
Select Replace(Replace(@strName, CHAR(13), ''), CHAR(10), ',') As Name
   

OutPut:

Name
————
Venu ,Thomas
(1 row(s) affected)

Tags:

  •  
  • Share with others:

    Thanks for visiting us! If you enjoyed these icons please feel free to share them! Or if you want to know what's going on with WiseCodes.com, follow us!

    3 Responses to “Add/Remove NewLine in SQL Query”

    1. what goes up, must come down?

    2. Wilbert Fenchel your flag on April 28th, 2010 at 10:12 PM
    3. I am surprised at the things I overlooked before I read this post. Thanks for the good information.

    4. windows registry cleaner your flag on August 13th, 2010 at 10:03 AM
    5. I am shocked at the items I overlooked before I read this post. Thanks for the great information.

    6. denise austin diet your flag on August 13th, 2010 at 10:10 AM

    Leave a Reply

    Anti-Spam Protection by WP-SpamFree

    Locations of visitors to this page eXTReMe Tracker