Hi all!
I want to remove all white space in a specific field From a Table in sql server during fetching data from C# code. I want to take all table field but I want to remove spaces from only one field. i am taking data from another server.
Is there any query in which I remove white spaces in create view of that table. Please assist me.
My table fields are like..
user_id user_name user_password Sequence
1241 rajan121 12345 A - B - C - D - E
I want to remove white spaces from Sequence like (A-B-C-D-E).
Loading


Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Nov 17, 2013, 7:40 PM EST
Try like this,
SELECT REPLACE(Sequence, ' ', '') from YourTable;
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Nov 21, 2013, 1:14 AM EST
Hanook159 reputationPosted Nov 21, 2013, 1:33 AM EST
OUTPUT:
A-B-C-D-E
So the SELECT query as follows:
SELECT REPLACE ( sequence, ' ', '')
FROM TableName;
Jignesh TrivediRank #16 · 50.3K reputationPosted Nov 21, 2013, 5:58 PM EST
agree with above answer you can use replace function to remove the space
select replace(' A - B - C - D - E',space(1),'')
refer
http://msdn.microsoft.com/en-us/library/ms186862.aspx
to know more about relace function
hope this will help you.