|
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
1
222
33333
4444444
I are troll
|
|
|
|
|
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
9999999999999999999
Here's my homework;
DECLARE @R AS INT
SET @R = 0
DECLARE @FILL AS INT
SET @FILL = 10
DECLARE @NUMCNT AS INT
SET @NUMCNT = 1
DECLARE @ROWSTR AS VARCHAR(100)
DECLARE @I AS INT
WHILE (@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
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
|
|
|
|
|
|
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? 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
|
|
|
|
|
How would it be possible to maintain, structure, scripts and preferably data (the whole shebang) between multiple Databases on different machines? Or is simple replication the way to go?
Mirroring?
|
|
|
|
|
Hmm I don't think replication is ever "simple" but it will achieve duplicating the database to additional copies. Get complicated when you need to replicate both ways.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
So what would you suggest? What I'm looking for is like source control for DB but atop all the scripts I'd like to move the data around as well.
|
|
|
|
|
Mustafa Ismail Mustafa wrote: What I'm looking for is like source control for DB but atop all the scripts I'd like to move the data around as well.
Now thats a different requirement altogether. I found a script that moves all procs into sourcesafe a few years ago - never used it but it should be around. We do not have the databases under source control but have a very strict backup policy.
We have a strict Dev/UAT/Production deployment path and only scripts can be deployed to production. We us Red-gate sql toolbelt. SQL Compare is bloody brilliant and I have just started to use SQL Data Compare on the latest project and it is excellent. That takes care of moving scripts and data through the deployment phases (we only deploy the static tables).
Recovery of old scripts is done by restoring a database to another server (localhost usually) and using sql compare to recover the script you need.
Whenever possible we take a copy of the production DB and restore it to UAT and Dev (before starting another development phase).
Reg-gate is really the tool you need to look into - I think they are a sposor of CP as well.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi All
To run an exe file using sp_xpcmdsell?
EXEC xp_cmdshell 'c:\testfolder\testexe.exe', NO_OUTPUT
Thanks & Regards,
Inder Dureja
|
|
|
|
|
what is response? is there any error?
which version of SQLServer you use?
|
|
|
|
|
Hi
I'am Looking for Batch file for open/close Oracle service.
thank's in advance
|
|
|
|
|
|
Hi,
I want to find out if there are special characters in the text fields values of my database. Is there a simple way to do this?
My current thoughts is using the complicated way of
SELECT * FROM MyTable
WHERE Col_Name LIKE '%~%' OR Col_Description LIKE '%~%'
OR Col_Name LIKE '%`%' OR Col_Description LIKE '%`%'
OR Col_Name LIKE '%!%' OR Col_Description LIKE '%!%'
OR Col_Name LIKE '%@%' OR Col_Description LIKE '%@%'
...
SELECT * FROM MyOtherTable
WHERE OtherCol_Name LIKE '%~%' OR OtherCol_Description LIKE '%~%'
OR OtherCol_Name LIKE '%`%' OR OtherCol_Description LIKE '%`%'
OR OtherCol_Name LIKE '%!%' OR OtherCol_Description LIKE '%!%'
OR OtherCol_Name LIKE '%@%' OR OtherCol_Description LIKE '%@%'
...
But maybe there's an easier way?
Thank you in advance.
Rafferty
|
|
|
|
|
By special characters, I meant all characters that are not alpha-numeric.
Thank you again.
Rafferty
|
|
|
|
|
|
Hi,
I have a access database and my table of access database have a Auto number field. and i insert 50 record in the access data and then i delete the last 25 records in the database. after this i insert new record but auto generated filed show the Id is 51. but i want to change it with 26. and next is autogenerated according to this. how i do this. please suggest.
Thanks
~Khatri Mitesh
khatrimitesh@hotmail.com
Bikaner (Rajasthan)
INDIA
|
|
|
|
|
As far as I remember you can't (not used Access for nearly 5 years ).
And why would you want too? Why was it made an Auto number in first place? If there's a good reason then you should not change it. For example, is it a foreign key in some other table?
However here's two possible approaches.
Use a non Auto number(long?) then before inserting a record do a SELECT to get the max in the field, add 1 to result and insert new record with this as value. You have to do this for every insert.
Alternatively, after deleting records, create a another table with same structure, copy records from the table to the new one (but exclude the Auto number field), delete the original table, rename the new one to the proper table name. Now you can insert and Auto number will work. But you would be mad to do this.
Regards
David R
|
|
|
|
|
Forget it, this is some stupid pratt who has no idea what a primary key is used for and is distressed about the missing numbers
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I was half hoping they'd go with the second alternative since it's obviously not the thing to do.
Regards
David R
|
|
|
|
|
Do NOT frack with the autonumber process, it is used as a primary key, a primary key should have ABSOLUTELY NO intelligent meaning, there should be no relevance whether the number is 26 or 51, it should ONLY be used for maintaining the relational structures.
Read some books on data structures and database design. This is Database 101 and should be known by EVERY developer who touches a relational database.
Leave the bloody thing alone !slap!
Never underestimate the power of human stupidity
RAH
|
|
|
|