What was that field name?

  • Note: This has only been tested in SQL Server 2008 SP3

    I tested this in SQL 2005 and your correct answer does not work. Are we to imply that you meant "specific" to a particular version?

  • I took a guess that the author was looking for the column list in the tooltip. However I very rarely use select * and surprisingly when I am typing a query I have both hands on the keyboard. The behavior is cool but not one I find useful since I don't use the mouse as my "goto" input device.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • Koen Verbeeck (8/6/2014)


    Nice question. I use SQLPrompt by Redgate so I immediately get all the column names and data types through the IntelliSense without even doing anything 😎 :w00t:

    +1 Thanks for the question.



    Everything is awesome!

  • Thank you for the post, Dave, very easy one. (at least of me, but the ratio is now almost 50-50).

    Seeing the field list in a tool-tip is easy without any much of efforts, just bring the mouse pointer top of it but I am not sure how many are out there who use a * in an select statement. Lets hope its not a real time query, just a practice query on the individual dev machine.

    ALT+F1, it just triggers the sp_help, a predefined query short cut, I have configured other queries similar and some different which I use them from time to time. I mainly explore the list of field names in Object explorer. you can set your own under Tools/Options/Environment (node in the tree)/Keyboard.

    ww; Raghu
    --
    The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.

  • Nice question. Thanks.

    - webrunner

    -------------------
    A SQL query walks into a bar and sees two tables. He walks up to them and asks, "Can I join you?"
    Ref.: http://tkyte.blogspot.com/2009/02/sql-joke.html

  • pmadhavapeddi22 (8/6/2014)


    Hany Helmy (8/6/2014)


    Easy, another fast way (but maybe not the fastest), just highlight the table then press Alt + F1 will give you all table structure, definition, columns names, data types, Identity fields (if any) and lot more.

    My ususal practice is alt + F1 (I though this option will be there in the list of answers but no ;-))

    Alt F1 doesn't seem to do anything for me. I'm on 2008 R2. Is that something in a higher version?

    Never mind. User error.

  • Did you highlight (select) the table first?

  • Julie Breutzmann (8/6/2014)


    Did you highlight (select) the table first?

    I misunderstood and highlighted the table on object explorer rather than the query. Then I realized what was meant and was able to work.

  • sdorris 90134 (8/6/2014)


    Note: This has only been tested in SQL Server 2008 SP3

    I tested this in SQL 2005 and your correct answer does not work. Are we to imply that you meant "specific" to a particular version?

    SQL Server 2005 does not support intellisense (even when using SSMS 2008+) so it wouldn't work.

    I think it's logical to infer* that if the question writer mentions a specific version on which the question was tested, the question and solution may not be applicable to other versions.

    * Speakers and writers imply; listeners and readers infer.

  • sp_columns TableName is less typing then select * from table name, which I do agree Alt + F1 would be easiest. 🙂

    The pain of Discipline is far better than the pain of Regret!

  • This didn't work for me right away, but I checked the Edit/IntelliSense menu, and turned on the List Members function with Ctrl+J, and then it worked.

  • SQLArnold (8/6/2014)


    sp_columns TableName is less typing then select * from table name, which I do agree Alt + F1 would be easiest. 🙂

    I interpreted the question to mean what is the quickest way if you have already entered the select statement as specified.

  • Alt + F1, because not only does it show you column names and datatypes, but you can also copy/paste from there into your query. Here's another tip: after you've brought up the table details using Alt+F1, hit F6 to quickly navigate / move cursor from the query to the details. F6 again to move to the next detail section. Shift + F6 to move backwards towards and into your query.

    Hakim Ali
    www.sqlzen.com

  • Note the original question asked about running this in Query Analyzer, whereas the answer was given using Management studio.

    Therefore the answer should have been that you can't connect to SQL 2008 from query analyser.

    Sorry for being pedantic,

    John

  • Nice question

Viewing 15 posts - 31 through 45 (of 53 total)

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