Sql server
-
how i can create pyramid in sql server 2005.
-
how i can create pyramid in sql server 2005.
-
Which pyramid you want to create by SQL Server 2005?!
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.
1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9
-
1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9
Here it is:
DECLARE @i AS INT SET @i=0 DECLARE @j AS INT SET @j=1 DECLARE @kosova AS VARCHAR(255) SET @kosova='' WHILE(@i<10) BEGIN WHILE(@j<@i) BEGIN SET @kosova=@kosova+CAST(@i AS VARCHAR(10)) SET @j=@j+1 END PRINT @kosova set @kosova='' SET @j=0 SET @i=@i+1 END
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.
-
Here it is:
DECLARE @i AS INT SET @i=0 DECLARE @j AS INT SET @j=1 DECLARE @kosova AS VARCHAR(255) SET @kosova='' WHILE(@i<10) BEGIN WHILE(@j<@i) BEGIN SET @kosova=@kosova+CAST(@i AS VARCHAR(10)) SET @j=@j+1 END PRINT @kosova set @kosova='' SET @j=0 SET @i=@i+1 END
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.
1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9
-
1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9
-
And your question is? I don't understand what you mean by this last pyramid!
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post.
1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 here the 1 printed after 8 spaces 1 times here 2 printed after 7 spaces 2 times . and so on .
-
how i can create pyramid in sql server 2005.
That is similar to calculating Mandelbrot sets in SQL, only somewhat faster. :)
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Saturday, March 28, 2009 1:46 PM
-
1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 here the 1 printed after 8 spaces 1 times here 2 printed after 7 spaces 2 times . and so on .
-
You're cheating! You can't get a decent pyramid by adding a number, you'll have to add two numbers to get a decent pyramid :laugh:
1
222
33333
4444444I are troll :)
i think u should try it , its possible in sqlserver . so dont laugh ,but try it.
-
i think u should try it , its possible in sqlserver . so dont laugh ,but try it.
-
i think u should try it , its possible in sqlserver . so dont laugh ,but try it.
Result
0 111 22222 3333333 444444444 55555555555 6666666666666
777777777777777
88888888888888888
9999999999999999999Here's my homework;
DECLARE @R AS INT
SET @R = 0
DECLARE @FILL AS INT
SET @FILL = 10
DECLARE @NUMCNT AS INT
SET @NUMCNT = 1DECLARE @ROWSTR AS VARCHAR(100)
DECLARE @I AS INTWHILE (@R < 10)
BEGIN
SET @ROWSTR = ''SET @I = 0 WHILE (@I < @FILL) BEGIN SET @ROWSTR = @ROWSTR + ' ' SET @I = @I + 1 END SET @I = 0 WHILE (@I < @NUMCNT) BEGIN SET @ROWSTR = @ROWSTR + CAST(@R AS VARCHAR) SET @I = @I + 1 END SET @R = @R + 1 SET @FILL = @FILL - 1 SET @NUMCNT = @NUMCNT + 2 PRINT @ROWSTR
END
:suss:
I are troll :)
-
Result
0 111 22222 3333333 444444444 55555555555 6666666666666
777777777777777
88888888888888888
9999999999999999999Here's my homework;
DECLARE @R AS INT
SET @R = 0
DECLARE @FILL AS INT
SET @FILL = 10
DECLARE @NUMCNT AS INT
SET @NUMCNT = 1DECLARE @ROWSTR AS VARCHAR(100)
DECLARE @I AS INTWHILE (@R < 10)
BEGIN
SET @ROWSTR = ''SET @I = 0 WHILE (@I < @FILL) BEGIN SET @ROWSTR = @ROWSTR + ' ' SET @I = @I + 1 END SET @I = 0 WHILE (@I < @NUMCNT) BEGIN SET @ROWSTR = @ROWSTR + CAST(@R AS VARCHAR) SET @I = @I + 1 END SET @R = @R + 1 SET @FILL = @FILL - 1 SET @NUMCNT = @NUMCNT + 2 PRINT @ROWSTR
END
:suss:
I are troll :)
ITS GOOD BUT THE RESULT IS NOT SO DESIREABLE . BECAE WHEN I PASS 5 THEN ITS NOT GINGING THE PROPER RESULT I NEED A DYNAMIC FUNCTION FOR ANY INPUT VALUE EX .FOR 5 1 ,1 TIMES 2 2 ,2 TIMES 3 3 3 ,3 TIMES 4 4 4 4 ,4 TIMES 5 5 5 5 5 ,5 TIMES I NEDD LIKE ABOVE
-
ITS GOOD BUT THE RESULT IS NOT SO DESIREABLE . BECAE WHEN I PASS 5 THEN ITS NOT GINGING THE PROPER RESULT I NEED A DYNAMIC FUNCTION FOR ANY INPUT VALUE EX .FOR 5 1 ,1 TIMES 2 2 ,2 TIMES 3 3 3 ,3 TIMES 4 4 4 4 ,4 TIMES 5 5 5 5 5 ,5 TIMES I NEDD LIKE ABOVE
Well, it's *your* homework obvious, not mine ;P Besides, my pyramid differs from yours, so you'll have to write your own anyway.. See, this below was your desired pyramidresult:
1 2 2 3 3 3 4 4 4 4 5 5 5 5 5
6 6 6 6 6 6
7 7 7 7 7 7 7
8 8 8 8 8 8 8 8
9 9 9 9 9 9 9 9 9and this was mine:
0 111 22222 3333333 444444444 55555555555 6666666666666
777777777777777
88888888888888888
9999999999999999999Your pyramid should only grow by a single number (e.g. 22 -> 333), whilst mine adds two numbers to each row (e.g. 111 -> 222 + 22 = 22222) Good luck :thumbsup:
I are troll :)
-
That is similar to calculating Mandelbrot sets in SQL, only somewhat faster. :)
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Saturday, March 28, 2009 1:46 PM
how i can create pyramid in sql server 2005. Do you having something called SQL-Pyramid-Building-Blocks? just like we have Intel Thread Building Blocks? :rolleyes: if one exists,I wish to suggest that to the OP!
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus