SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


ANSI_PADDING


ANSI_PADDING

Author
Message
Pawel Borkowski
Pawel Borkowski
SSCrazy
SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)

Group: General Forum Members
Points: 2464 Visits: 84
I did it but it returns 4,4,3. So the answer was wrong!

set ansi_padding on;
go

create table #q (v varchar(5) );
go

insert into #q
select 'ABC' UNION ALL
select 'ABC ' UNION ALL
select 'ABC ' UNION ALL
select 'ABC '

select * from #q

select COUNT(*) from #q where v = 'ABC';
select COUNT(*) from #q where v = 'ABC ';
select COUNT(*) from #q where v LIKE 'ABC ';

drop table #q
go
Hugo Kornelis
Hugo Kornelis
SSCoach
SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)

Group: General Forum Members
Points: 18643 Visits: 12426
Pawel Borkowski (12/22/2011)
I did it but it returns 4,4,3.

You might want to double check the code you typed, and compare it to the code in the original question. Pay extra attention to the number of trailing and leading spaces.


Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Pawel Borkowski
Pawel Borkowski
SSCrazy
SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)

Group: General Forum Members
Points: 2464 Visits: 84
How to count spaces on the image? !#$%!$^@#$%@!
Can you tell me what was the right count of spaces in this example?
Paul White
Paul White
SSC-Dedicated
SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)SSC-Dedicated (35K reputation)

Group: General Forum Members
Points: 35054 Visits: 11359
Pawel Borkowski (12/22/2011)
How to count spaces on the image? !#$%!$^@#$%@!
Can you tell me what was the right count of spaces in this example?


insert into #q
select 'ABC' UNION ALL
select 'ABC ' UNION ALL
select 'ABC ' UNION ALL
select ' ABC '





Paul White
SQLPerformance.com
SQLblog.com
@SQL_Kiwi
Pawel Borkowski
Pawel Borkowski
SSCrazy
SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)SSCrazy (2.5K reputation)

Group: General Forum Members
Points: 2464 Visits: 84
So I lost the space before Smile
It changes everything! w00t
Thx
Ryan Barrett
Ryan Barrett
SSChasing Mays
SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)SSChasing Mays (641 reputation)

Group: General Forum Members
Points: 641 Visits: 67
Interesting question. Thanks.



Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search