December 11, 2009 at 7:45 am
A variation of this question could be:
DECLARE @inc int, @dec int;
SELECT @inc = 1, @dec = 10;
DECLARE @temp table (StringA varchar(20), StringB varchar(20));
WHILE @inc <= 10
BEGIN
INSERT INTO @temp VALUES ( SPACE(@inc)+'Hello',
SPACE(@dec)+'Hello');
SET @inc = @inc + 1;
SET @dec = @dec - 1;
END
select * from @temp
SELECT COUNT(*) FROM @temp WHERE LEN(StringA)= LEN(StringB);
March 20, 2010 at 3:28 pm
Another lucky guess 🙂
When you pipe the results out to a text file, you get:
StringA,StringB
hello ,hello (one space after first hello)
hello ,hello (2 spaces after first hello, etc...)
hello ,hello
hello ,hello
hello ,hello
hello ,hello
hello ,hello
hello ,hello
hello ,hello
hello ,hello
with 7 spaces AFTER each second hello, interesting result... why 7 spaces??
Peter Trast
Microsoft Certified ...(insert many literal strings here)
Microsoft Design Architect with Alexander Open Systems
Viewing 2 posts - 16 through 16 (of 16 total)
You must be logged in to reply to this topic. Login to reply