Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
avijit_mca
Posting Yak Master
109 Posts |
Posted - 2009-10-12 : 03:25:24
|
| 1. How i will remove space in sql with out using trim function.2. I have two same constrain with different name on colum called x.now if i inserted value on colum x then how many time it will checkk constrain. Regards,avijitRegards,avijit |
|
|
varunragul
Starting Member
10 Posts |
Posted - 2009-10-12 : 06:30:08
|
| 1) One of the way without using TRIMIf u know u r output Length then Select CAST('varunragul' as Char(5))2) 2 |
 |
|
|
avijit_mca
Posting Yak Master
109 Posts |
Posted - 2009-10-16 : 07:26:27
|
| Thanks for ur reply but its not working.declare @x as varchar(50)set @x=' abc '--2 spaceselect @x,CAST(@x as Char(3))out put : aRegards,avijit |
 |
|
|
YellowBug
Aged Yak Warrior
616 Posts |
Posted - 2009-10-16 : 07:37:02
|
You can use REPLACE to remove all spaces (anywhere in the string):declare @x as varchar(50)set @x=' abc '--2 spaceselect @x = REPLACE(@x, ' ', '')select @x,CAST(@x as Char(1)) Or LTRIM(RTRIM(@x)) to remove leading and trailing spaces only. |
 |
|
|
|
|
|