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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SPACE in a column data - Update

Author  Topic 

shiyam198
Yak Posting Veteran

94 Posts

Posted - 2010-06-24 : 11:32:43
Hi,

When I try this in a table I get 900 rows. (looking for the records where there is a space after the word 'UNRESERVED'.

select * from BICData02.dbo.src_live_order_admissions
where src_adm_seatloc_section like 'UNRESERVED '

Then updated this with the following script.

update BICData02.dbo.src_live_order_admissions
set src_adm_seatloc_section = 'UNRESERVED'
where src_adm_seatloc_section = 'UNRESERVED '

but when i try

select * from BICData02.dbo.src_live_order_admissions
where src_adm_seatloc_section like 'UNRESERVED '

I still get 900 rows.

But when I check the individual valued looks like the space is removed. Not sure why they are showing in the result of the select query.

Can someone help.

Thanks for your time.

- Shiyam

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-06-24 : 11:44:39
What datatype?
Is it CHAR?


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

slimt_slimt
Aged Yak Warrior

746 Posts

Posted - 2010-06-24 : 15:33:29
regardless of spaces in your text, you can update your string with same strings trimmed with spaces and your query will still give you results as you are describing above.

if your column types are varchar, nvarchar, char or nchar your queries won't have any affects.
if you are using text, ntext or image your spaces will be preserved.
Go to Top of Page
   

- Advertisement -