views:

31

answers:

5

When writing a statement

select * from tableName

you get all the fields, however I want to get all the fields in the statement for better code, is there a tool to do it faster in SQL Server, to get

select f1,f2,f3 from tableName

which are all the fields in tableName

+4  A: 

In the management studio you can drag-drop the columns-node from the table into the query.

Yves M.
SWEET! that works.
none
+1 Wow, that`s even more comfortable than my suggestion to use query editor in SSMS
tombom
+1 Quicker to do than my suggestion
AdaTheDev
A: 

In SSMS, right click the table -> Script table as... -> SELECT to... New query editor window

That'll do the trick

AdaTheDev
A: 

in sql server management system

  • right click on the table

  • "script table as"

  • "select"

  • "new query windows"

remi bourgarel
A: 

In Sql Server Management Studio, if you right click on the table you can create script for simple instruction (SELECT, INSERT, UPDATE, DELETE) and also to alter the table definition (CREATE, ALTER, DROP)

il_guru
+1  A: 

The SQL Prompt add-on by Red-Gate Software has this functionaliy.

You type:

SELECT *(caret here) FROM dbo.YourTable

and then you press the TAB key - and voila, the list of fields from that table is inserted instead of the *

And of course, SQL Prompt does a lot more too! Great tool, absolutely essential for me - use it all the time. Well worth the product price!

marc_s
thanks , i'll check it out.
none