TIPS: SQL Server Management provides the simplest SQL query statement format

Source: Internet
Author: User
Tags sql server management
Copyright: Original Works are allowed to be reproduced. During reprinting, be sure to mark them as hyperlinks. Article Original source, author information, and this statement. Otherwise, legal liability will be held. Http://www.cnblogs.com/jintan/archive/2008/03/27/1125853.html

If you write too many SQL statements, it will inevitably lead to headaches for messy SQL statements.CodeIt looks comfortable, eye-catching, and clear.

T-SQL statement itself does not have the formatting standard, so, basically everyone has their own style, and currently see formatting SQL tool does not seem to be much, or the function is very weak, in fact, the most ideal thing is to integrate SQL code format functions into the development environment, such as integration into SQL Server Management or VS, which is more convenient.

Now let's take a look at the SQL Server Management built-in small stuff to format the SELECT statement, known as "design query in the editor" (the last button in). It is estimated that many friends did not notice

The original messy SQL statement is as follows:

Select C. fname, C. furl, B. fdisplayname, B. fmoduleid, B. ffuncname,. fauflag, B. frelpageurl from funcinroles as a inner joinfuncinfos as B on. ffuncid = B. ffuncid inner join modules as C on C. fmoduleid = B. fmoduleidwhere (. froleid = @ roleid) and (B. fmoduleid = @ fmoduleid) and (. fschoolid = @ schoolid)
 
Select the code to be formatted in the code editor. Click
 
 
 
The code is formatted immediately, as shown in figure
 
 
 
Formatted code:
 
Select C. fname, C. furl, B. fdisplayname, B. fmoduleid, B. ffuncname,. fauflag, B. frelpageurlfrom funcinroles as a inner joinfuncinfos as B on. ffuncid = B. ffuncid inner joinmodules as C on C. fmoduleid = B. fmoduleidwhere (. froleid = @ roleid) and (B. fmoduleid = @ fmoduleid) and (. fschoolid = @ schoolid)
 
 
 
Haha, formatting is not ideal, but it is much better than the original one. In addition, this stuff can only format the SELECT statement. After all, it is just a query designer. Don't report too high expectations.
 
I hope to help you.
I will release the SQL Server 2005 and vs 2008 plug-ins developed by me in a few days. The functions include:
    • Complete SQL code formatting
    • Quickly locate and search database objects
    • SQL code area collapse # region... # endregion
    • .....
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.