sql - is there any `backspace` character in mssql for string? -


Below is the query for a string company description by adding name, address 1 and address 2. And here I am using the concatenate APPT SEP ('') for the ISNULL () function if the column is zero.

  Select name as compdeeatils from Table Companie + ',' + isnull (Address1, '') + ',' + isnull (Address2, ') where id = 4 < / Code>  

This is the issue of the question, because address 1 or address2 is zero. It will spoil the comma before the empty space which I do not want ..

If address 1 and address 2 tap, then result will be name, how can I remove it? Is there any backspace features in mssql ??

I have found the answer to this simple argument .. inside the ISNULL () function Add Coma. Select

  name + isnull (',' + 1 address, '') + isnull (',' +2, '') where compounds as compounds ID = 4   

Note : The name will not give NULL in my case. In case the name is also zero, this answer is not applicable.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -