|
|
Thank you, Richard.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
As long as you never have more than one value per row and column it doesn't matter very much which function you use as long as it works with text. (Min, Max or user defined).
But depending on your data it might be possible to get more than one value per cell, then you need to choose what to show. That's what the aggregate function is for.
|
|
|
|
|
Thank you Jörgen.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
This is a call for resources.
I have been to 2 interviews recently and totally blew the technical written tests that involved SQL and SQL Server.
Though I've used SQL and done database design in the past, my current role hasn't afforded me any substantial experience in the last 5 or 6 years.
Can you recommend any books or online courses on SQL, T-SQL, and SQL Server programming to get me back up to speed?
I was on Amazon and found a bunch, but I figure you people would know better.
Cheers,
Mike Fidler
"I intend to live forever - so far, so good." Steven Wright
"I almost had a psychic girlfriend but she left me before we met." Also Steven Wright
"I'm addicted to placebos. I could quit, but it wouldn't matter." Steven Wright yet again.
|
|
|
|
|
|
Thanks. Looks great. I signed up.
Cheers,
Mike Fidler
"I intend to live forever - so far, so good." Steven Wright
"I almost had a psychic girlfriend but she left me before we met." Also Steven Wright
"I'm addicted to placebos. I could quit, but it wouldn't matter." Steven Wright yet again.
|
|
|
|
|
Hi
How to get information from one database.
like only required columns by select * from sys.sysdatabase
|
|
|
|
|
|
Your question is not very clear.
Are you after certain columns from the sys.sysdatabase view?
Are you after looking at certain information about a database?
Are you looking at comparing tables within one or more databases?
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
Hello All,
I am trying to schedule to run a trace file, around 12:30am to 1:00am. Our client is sending us some data, that we need to analyze.
With that said, i can see we can set an "Enable Trace stop time", on the file, but not able to find an option to set the begin time?
Is there a way we can do this in the SQL Profiler?
Thanks!
|
|
|
|
|
|
VK19 wrote: Our client is sending us some data, that we need to analyze.
Why would you need to schedule this? Is the 'client' putting the data directly into the database?
|
|
|
|
|
Client sends us the data between 12:30am and 1:00am EST.
|
|
|
|
|
Not sure that answers the question.
Is the client themselves directly putting data into your database?
Or do they send you 'something" (file, stream, etc) which is then processed by your (company) code and that process itself puts the data in the database?
Or could be that your code is pulling something from the client, processing it, and then putting it in the database.
|
|
|
|
|
Sorry - the second option, wherein the client sends us a file, with test cases. Apparently one test case at a time. Our company then processes this test case and inserts into our database.
thanks!!
|
|
|
|
|
So then you can do the following
1. Keep the file
2.During the day run the same process/processes on that in a development environment.
3.Profile the applications and turn on tracing every where you can.
4. Analyze the results.
5. Update as needed based on 4 including the possibility of modify the process/processes to provide addition trace data so you can further refine and define future problems.
|
|
|
|
|
Hi
I wrote this code in notepad ++ :
<?php
ini_set("memory_limit",-1);
$myArray = Array();
$connection = mysqli_connect("localhost","my_user","my_password","my_db");
$result = mysqli_query($connection, "SELECT * FROM tablename");
while(($row = mysqli_num_rows($result))== null){
array_push($myArray,$row);
}
echo json_encode($myArray);
mysqli_close($connection );
?>
And run it with wamp localhost . Then I got this error in my browser :
Fatal error: Out of memory (allocated 408944640) (tried to allocate 805306376 bytes) in D:\...\page1.php on line 10
What's problem ? Can anybody says ?
|
|
|
|
|
The problem is that you are trying to create some variable that is too big for the amount of available memory. Most likely you are extracting too many records from the database.
|
|
|
|
|
Ok Thanks , Now What's the true format of this code ?
|
|
|
|
|
The true format is to understand how computers handle and store information, and not to assume that memory is infinite.
|
|
|
|
|
Adding to the above.
Never attempt to return all records from a table(s) where that table can have a 'large' size where large can range from about 10,000 and on up.
Never do this when the result is for a UI. Just do not allow it. Reason is that no user is going to page through hundreds of pages (multiple items per page) randomly. Rather such a user always knows what they are looking for so require that the user provide more information to narrow the search. This can be designed specifically such that the api (your method) requires paging (page number and page size) and then the method only returns that page.
Additionally the framework or php is providing an implementation of an array which grows to meet the maximum size of data. That is optimized to grow at a rate which is probably doubling every time the previous limit is reached. And you are attempting to put a very large number of records in that array. So at that limit it attempts to double the size of the existing array and fails because there is no more memory in the application. Fix the design rather than attempting to optimize the size yourself (don't return everything.)
|
|
|
|
|
Ok Thanks , Now What's the true format of this code ?
|
|
|
|
|
Depends on usage...
But one implementation, as I already suggested would be to pass in a 'page' and 'page size'.
Then your method finds the 'page' and returns no more than 'page size' items.
Then your 'Array' would never be any bigger than 'page size'. Could be less because there could be less than that.
|
|
|
|
|
As already explained by others the error tells you that you ran out of memory because you have requested to return all data from a huge database.
Your program stops execution when $myArray is full while using already 408 MB of memory. Then the allocation of additional 805 MB failed (the already allocated 408 MB would be freed but that would occur after the content has been copied to the new memory).
You have to limit the number of returned data by using a search term
SELECT * FROM tablename WHERE <search condition> or get the data in chuncks (page wise) using the LIMIT clause: PHP Limit Data Selections From MySQL[^].
|
|
|
|