Yes, SELECT TOP 60 FROM Table ORDER BY date DESC. If it is good enough for every database professional on every database platform, then I would suggest that it isn't as bad as seem to think! If I understand what you mean by 'sorted' then I suggest that you find an article/book about how databases store data; I think that you will be very surprised.
If you are already ordering the fields and know you need records from end, why not store them the opposite way as current. I mean order records from current to older dates. In that case all you will need is to get top xx records from the table.
This should have been thought while designing database IMHO.
"No matter how many fish in the sea; it will be so empty without me." - From song "Without me" by Eminem
The default of nvarchar is for unicode and should not be used unless you intend to store non english characters. I would recommend using varchar(##), the length should be slightly larger than the max characters you expect. varchar can be used for up to 8000 characters, this generally meets most requirements. varchar(max) I would only use if you need to store a serious amount of text in a field, ie. a book or at least a story.
Never underestimate the power of human stupidity
i have one issue in using nested procedure, both procedure having hash table with same name because of which there is an issue for executing same procedure through ASP.net (it not showing issue in sql server)
so i need how to find nested procedure from huge database
i have two tables that have Many-to-many relationship (personality-to-(Personality_PersonalitySubtypes)-PersonalitySubtypes)
in normal scenarioes , u would select all personalitySubtypes by knowing only the personalityID by inner join the three tables
but suppose that i need the reverse case , i need to select the personalityID by knowing the four combinations of personalitysubtypes knowing that i need it to be completely accurate means if one of the four combination changes the whole personalityID may be changed . how could i do that in sql ?
i tried data structures in C# to iterate and blah blah blah till my brain is down
Hi i am working on vb.net 2008 with mysql.my application will run on lan i want to build a form where user can view all available servers on lan and connect to one he finds suitable.
earlier in sql server i used sqldmo for the same but in mysql i found no such alternatives.???
can smone help???
one more thing i would like to add that is my mysql is version 4.x )
if you want to do anything with databases and are new to it, the only advice I have for you is to buy and study a book on the subject; you just can't improvise a DB app and expect it to work reliably without a solid foundation.
The particular answer would be along these lines:
UPDATE tablename SET fieldname=expression_using_field_values_and_or_constants WHERE field1=value1 AND field2=value2
Googling for SQL update would yield this[^] amongst others.
Luc Pattyn [Forum Guidelines][Why QA sucks][My Articles] I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
You know this update uses composite key (bookId, pageId, PKValue) to update one single field.
Let me append: for all the selected records.
Now for example I have to updates 200 position of this pageId = 1 and bookId = 22
I have to call 200 times this Query.
If you want the same update to apply to all 200 records, then write your query to update all 200 records and just call it once. You need to write your query to do what you want. Perhaps a book, like Luc Pattyn suggested would be helpful to you.
Now I need to join the results of the stored procedure to a another table joined by Id, either in a View or another Stored Procedure. Can I do this, keeping in mind that the number of columns and the names of the colums are variable. The only constant is the Id column name.
------------------------- Real programmers don't comment their code. If it was hard to write, it should be hard to read.
Last Visit: 31-Dec-99 19:00 Last Update: 6-Dec-23 8:49