QOD june 27 select * from

  • The author of the question states : "arrange your text columns last in your database schema".

    I do not agree. The order of columns in your table should never matter. Do not use "select * from" in an application, this is a bad practice. Always explicitly enumarate the columnnames you need, and only these. The query analyzer of SQL Server can do this for you. If you work this way, you will have less problems with your application when the database schema changes, you will only retrieve the columns needed and you can avoid dynamic detecting datatypes. The last two point will boost performance of your appliction.

  • I think you've missed the point. There's a "feature" in ADO that struggles with text type.

  • I got the question right, but only because I think I'm getting used to the wording of the QOD. This question is particularly troublesome, as there are 2 correct answers. SiteOwners, please take a look at the following KB article (kb 175239) clearly states that the order of the columns is the cause of the problem, and changing the order will correct the issue, but that upgrading to MDAC 2.1 sp2 will also solve the issue:

    http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q175/2/39.ASP&NoWebContent=1

    Much as I hate to say it, this one really is misleading...

  • quote:


    I do not agree. The order of columns in your table should never matter.


    But that is the point. In this instance, the order of the columns DOES matter. Whether or not you use Select * or Select w/column names, you need to make sure any text columns are last in the ADO Fields collection.



    Mark

  • Again a case of careful reading. asp-page, web app, ado...

    But to be honest, I was more guessing than knowing. Anyway two points are two points

    Cheers,

    Frank

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

  • I thought it was common knowledge/best practice to always put text columns last. No one is saying we should rearrange the table design at all, just explicitly select like this

    select SalesID, SalesDesc, SalesAmmount, SalesComments from...

    Also I would rename the SalesAmmount column to the correctly spelled SalesAmount


    Michael R. Schmidt
    Developer

  • MOD PARENT UP!

    Sorry for the slashdotism, but jpipes is correct:

    quote:


    ...there are 2 correct answers. SiteOwners, please take a look at the following KB article (kb 175239)...


    And like jpipes, I also got the question right by playing psychoanalyst / Kreskin with the question, inferring what the preferred answer would be. 😀

  • So, the QOD was a test to understand if we knew the workaround for a bug that has been fixed since MDAC 2.1? Hmmm....

    --

    Si Chan

    Database Administrator

  • quote:


    I think you've missed the point. There's a "feature" in ADO that struggles with text type.


    I did not mis the point of the question. But I think you've missed mine. My point is that you're application should not depend on the order of the columns of the table. You should never use select * in an application.

    Suppose you did and in this case you put the blob column last. But lateron with a new version of the application you need to add a column to the table. But you're blob column has to stay last. Thus you have to reconstruct the table completely, just because you use select * in your application (maybe retreiving columns you don't need). Sounds crazy to me. So I suggest to always

    explicitly reference the columns in your queries and if necessary, put the blobs columns last in the query.

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply