• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
Collapse

You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:

  • You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
  • You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
  • If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.

Previously on "Sql server 2008 idiosyncrasy"

Collapse

  • original PM
    replied
    oh yeah absolutley no qualms about it

    I only really use it to generate a query I then thrown into report builder 2 to create an .rdl file so the user can run the query to their hearts content.

    I am not a developer so only really do this sort of stuff as a side line!

    Leave a comment:


  • Spacecadet
    replied
    Originally posted by original PM View Post
    If you are a bit of an SQL noob (like me) it is often easier to use the design query in editor option


    You do realise you're shooting yourself in the foot using that and its obvious to anyone else how you generated the SQL.

    Leave a comment:


  • rsingh
    replied
    Originally posted by original PM View Post


    never managed to get my head around grouping yet though.
    Patience young grasshopper...

    Leave a comment:


  • original PM
    replied
    If you are a bit of an SQL noob (like me) it is often easier to use the design query in editor option

    then you can select exactly the fields you want from each table in the order you want - also you can get the joins sorted by just dragging a line between the primary key on the relevant tables..

    and also easy to set parameters and other things


    never managed to get my head around grouping yet though.

    Leave a comment:


  • Sysman
    replied
    Originally posted by PerlOfWisdom View Post
    The reason for using it would be to see the whole table but with the field of interest on the left. This would never be used programatically.
    Correct, but if the order of the columns is important you should really specify each by name.

    As others have suggested.

    Leave a comment:


  • Zippy
    replied
    Originally posted by jmo21 View Post
    Using * can also cause a creep in performance degradation as more columns get added to a table over time.
    It causes a performance degradation from the start. * is shorthand for 'look up what the table cols are in the system tables'.

    Leave a comment:


  • jmo21
    replied
    Using * can also cause a creep in performance degradation as more columns get added to a table over time.

    Leave a comment:


  • PerlOfWisdom
    replied
    Originally posted by kandr View Post
    The SELECT LogId is redundant as you are doing a SELECT *.
    The reason for using it would be to see the whole table but with the field of interest on the left. This would never be used programatically.

    Leave a comment:


  • Spacecadet
    replied
    Originally posted by VectraMan View Post
    Surely there's nothing wrong with the "select *". It's using select * and a column by name that doesn't make any sense and shouldn't suprise anyone that the behaviour might vary. Even I know that with my very limited SQL ability.
    problem with using select * is that if anything changes to the table you're selecting from then your SQL is still valid when it should more than likely be invalid.

    Leave a comment:


  • kandr
    replied
    Originally posted by fullyautomatix View Post
    This SQL works in SQL 2000

    SELECT LogId, * FROM Logs
    Order by LogId DESC

    This fails in SQL 2008 with the error message

    Ambiguous column name 'LogId'.

    How ridiculous ? Luckily not affected too much but this could have easily meant a big migration headache.
    The SELECT LogId is redundant as you are doing a SELECT *.

    Leave a comment:


  • VectraMan
    replied
    Originally posted by Spacecadet View Post
    This is another reason why "select *" should NOT be used anywhere near production! Microsoft themselves advise against it.
    Surely there's nothing wrong with the "select *". It's using select * and a column by name that doesn't make any sense and shouldn't suprise anyone that the behaviour might vary. Even I know that with my very limited SQL ability.

    Leave a comment:


  • Spacecadet
    replied
    Originally posted by lilelvis2000 View Post
    Assuming that does work T-SQL.
    It does


    Originally posted by fullyautomatix View Post
    This SQL works in SQL 2000

    SELECT LogId, * FROM Logs
    Order by LogId DESC

    This fails in SQL 2008 with the error message

    Ambiguous column name 'LogId'.

    How ridiculous ? Luckily not affected too much but this could have easily meant a big migration headache.
    This is another reason why "select *" should NOT be used anywhere near production! Microsoft themselves advise against it.

    Leave a comment:


  • lilelvis2000
    replied
    Originally posted by PerlOfWisdom View Post
    You're selecting [LogID] twice (once in the *) so it doesn't know which one to sort by.
    Correct. Either alias the column or use Orderby 1 desc

    Assuming that does work T-SQL.

    Leave a comment:


  • PerlOfWisdom
    replied
    Originally posted by fullyautomatix View Post
    This SQL works in SQL 2000

    SELECT LogId, * FROM Logs
    Order by LogId DESC

    This fails in SQL 2008 with the error message

    Ambiguous column name 'LogId'.

    How ridiculous ? Luckily not affected too much but this could have easily meant a big migration headache.
    You're selecting [LogID] twice (once in the *) so it doesn't know which one to sort by.

    Leave a comment:


  • fullyautomatix
    started a topic Sql server 2008 idiosyncrasy

    Sql server 2008 idiosyncrasy

    This SQL works in SQL 2000

    SELECT LogId, * FROM Logs
    Order by LogId DESC

    This fails in SQL 2008 with the error message

    Ambiguous column name 'LogId'.

    How ridiculous ? Luckily not affected too much but this could have easily meant a big migration headache.

Working...
X