remove commas in a column in mssql
-
i have a string data in a column in an msqsql database table and the values are separated by commas (,)eg 01,02,M,1,045,12,1948 i want to remove the commas in that column so that the data looks like 0102M1045148. can any one help me . thanks members :sigh:
phokojoe
-
i have a string data in a column in an msqsql database table and the values are separated by commas (,)eg 01,02,M,1,045,12,1948 i want to remove the commas in that column so that the data looks like 0102M1045148. can any one help me . thanks members :sigh:
phokojoe
-
select replace(Columnname,',','') from TableName
I Love T-SQL "Don't torture yourself,let the life to do it for you."
-
thanks Blue_Boy, i am going to try it, but by the look of the syntax, it will work. thanks once more :-D
phokojoe
-
I have tested that query and it has worked for me, and sure will work for you too.
I Love T-SQL "Don't torture yourself,let the life to do it for you."
i have just tested it, but the problem is, i have so many entries in that column. when i write a column name, it does not replace the commas, instead it returns the column name not even the entries in that column. eg. like i said, the values in that column are of this shape: 01,02,M,045,1948,2,21 and the column name (field) is say column1 i will write: select replace('column1',',','') it only returns column1 not 0102M0451948221. please help me on this. :rolleyes:
phokojoe
-
i have just tested it, but the problem is, i have so many entries in that column. when i write a column name, it does not replace the commas, instead it returns the column name not even the entries in that column. eg. like i said, the values in that column are of this shape: 01,02,M,045,1948,2,21 and the column name (field) is say column1 i will write: select replace('column1',',','') it only returns column1 not 0102M0451948221. please help me on this. :rolleyes:
phokojoe
phokojoe wrote:
select replace('column1',',','')
is not correct bcause you have write columnename inside single qutes Try again code down below
Select replace(columname,',','') from tablename
I Love T-SQL "Don't torture yourself,let the life to do it for you."
-
phokojoe wrote:
select replace('column1',',','')
is not correct bcause you have write columnename inside single qutes Try again code down below
Select replace(columname,',','') from tablename
I Love T-SQL "Don't torture yourself,let the life to do it for you."
-
yah yah yah, without you i could have not survived this stress. i have done it! it works. thanks once more.
phokojoe