Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««123

ANSI_PADDING Expand / Collapse
Author
Message
Posted Thursday, December 22, 2011 1:54 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Wednesday, July 9, 2014 11:56 PM
Points: 2,138, Visits: 70
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
Post #1225614
Posted Thursday, December 22, 2011 2:48 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 1:54 PM
Points: 6,130, Visits: 8,394
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
Post #1225639
Posted Thursday, December 22, 2011 3:02 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Wednesday, July 9, 2014 11:56 PM
Points: 2,138, Visits: 70
How to count spaces on the image? !#$%!$^@#$%@!
Can you tell me what was the right count of spaces in this example?
Post #1225652
Posted Thursday, December 22, 2011 3:35 AM


SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: Yesterday @ 4:18 PM
Points: 9,928, Visits: 11,206
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
SQL Server MVP
SQLblog.com
@SQL_Kiwi
Post #1225684
Posted Thursday, December 22, 2011 3:58 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Wednesday, July 9, 2014 11:56 PM
Points: 2,138, Visits: 70
So I lost the space before :)
It changes everything!
Thx
Post #1225700
Posted Thursday, January 5, 2012 3:51 AM
SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Friday, December 6, 2013 7:23 AM
Points: 614, Visits: 57
Interesting question. Thanks.


Post #1230593
« Prev Topic | Next Topic »

Add to briefcase «««123

Permissions Expand / Collapse