Sql Server management studio how to auto capitaliz

2020-03-01 09:08发布

问题:

Is there any FREE "build-in" way to capitalize the "keywords" in the SQL 2005/2008 management studio when you write a sql query?

i.e

truncate table x

should be automatically changed to:

TRUNCATE TABLE x

回答1:

the intellisense in the 2008 management studio will do this as well as long as you are connected to a SQL 2008 database.

You can change the case you prefer to upper or lower under Tools / Options / Text Editor / Transact-SQL / IntelliSense



回答2:

There is no built in 'intellisense' in SQL Server 2005 (there is in 2008) but Redgate do an add-in for exactly this and more. It will auto-complete table names, columns, add square brackets, re-format stored procs etc, and it works well:

http://www.red-gate.com/products/SQL_Refactor/index.htm



回答3:

I found a hidden gem for auto upper/lower case formatting and indenting in SSMS that I will forever use. No more "New Query".

Rt-Click table name within Object Explorer | Edit Top 200 Rows | QueryDesigner menu option | Pane | SQL. Write or drop in some ugly, non formatted SQL. QueryDesigner | Verify SQL Syntax will UC reserved words and indent for you.



回答4:

You can use New Query and type in your SQL in lower case in the editor. To change keywords to upper case, select the SQL then press Ctrl + Shift + Q. The Query Designer will open. Highlight the SQL and then right click to bring up menu and choose verify SQL Syntax which will upper case keywords and format the SQL.