CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 1999
    Posts
    11

    What is better SELECT * or SELECT field names

    What is better to use when retrieving all the fields from a table when making a query along one of the following lines

    SELECT * FROM Customer WHERE CustomerID = 4

    SELECT * FROM Accounts WHERE AccountID = 100 AND Customer ID = 4

    What is better individually listing each field name in the query or using *. What is more faster and more efficient. Thanks for your help


  2. #2
    Join Date
    Apr 1999
    Posts
    7

    Re: What is better SELECT * or SELECT field names

    I would take * because it is made for it.


  3. #3
    Join Date
    Apr 1999
    Location
    New Zealand
    Posts
    8

    Re: What is better SELECT * or SELECT field names

    It makes virtually no difference, because the SQL gets expanded from "SELECT *" to "SELECT [Field1], [Field2], etc." before the database engine is queried.

    The only overhead is when the SQL is initially parsed and for most cases this will be negligable.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured