Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 258049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:08:53+00:00 2026-05-11T22:08:53+00:00

None of my SQL Server stored procedure editing IDEs seem to have any tools

  • 0

None of my SQL Server stored procedure editing IDEs seem to have any tools to enforce indentation styles, so I find that a lot of the stored procedures I see are all over the place. I find indenting really improves readability though. I would like to codify some stored procedure indenting standards in our company’s coding style guide, and I’m wondering if anyone has any best practices they would like to share.

For instance, in a normal SELECT statement, I try to keep the SELECT, FROM, WHERE, ORDER BY, and GROUP BY clauses all on the same level, and indent anything below that. I also try to indent each JOIN one level from the table it’s logically joining into.

Does anyone else have similar advice or best practices?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T22:08:53+00:00Added an answer on May 11, 2026 at 10:08 pm
    SELECT      T1.Field1,
                T1.Field2,
                T2.Field1 As Field 3
    FROM        Table1 AS T1
    LEFT JOIN   Table2 AS T2
    ON          T1.Field1 = T2.Field7
    WHERE       T1.Field9 = 5
    AND         T2.Field1 < 900
    ORDER BY    T2.Field1 DESC
    
    INSERT INTO Table1 (
                Field1,
                Filed2,
                Field3 )
    VALUES (    'Field1',
                'Field2',
                'Field3' )
    
    UPDATE      Table1
    SET         Field1      = SomeValue,
                Field2      = AnotherValue,
                FIeld134567 = A ThirdValue
    WHERE       Field9      = A Final Value
    

    I find that I dont necessarily has a set indentation length and instead I try to indent based on the length of the field names and values. I like my left margins to line up along any given vertical plane and I like my Evaluators (such as equal signs) to line up. I always have any command term on a different vertical plane than its accompanying values and fields. I also tend to try to make the space between my SELECT command and the Field list equal in length to the space used by a SELECT DISTINCT Field or INSERT INTO Table.

    But in the end, all that is just my preferences. I like neat looking code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have the following stored procedure in sql server and i am trying to
We have a SQL Server DB with 150-200 stored procs, all of which produce
I have an existing SQL 2005 stored procedure that for some reason, outputs its
I have SQL Server 2005 and all dates are stored using a DATETIME column
I am trying to call a SQL Server stored procedure from my Python code,
I have tried different methods and none of them seem to work. When I
I have the following statement in a stored procedure: DECLARE @Count INT EXEC @Count
I am developing a C# VS 2008 / SQL Server 2008 website. I have
I have a SQL Server database and I'm using ADO.NET ExecuteReader to get a
Does anyone have an example of a stored procedure which makes a connection to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.