question

vshimpi avatar image
vshimpi asked

query standards for sql?

is there any query standards for sql procedure, sql query , trigger , Currsor. or there is any format for query..
sql-server-2008selecttriggercursorprocedure
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
ThomasRushton avatar image
ThomasRushton answered
Hi No, there are no standards. You can write your entire query on one line, or you can format it so it's readable. There are no standard formatting rules. Everybody likes their own. However, you can make a good start towards defining your own in-house standard by picking a relatively complex query and running it through various on-line code prettifiers (eg [Red Gate's Format-SQL][1]). Be warned. This can rapidly approach "holy wars" territory. If you're just starting out, though, I would recommend that you end any statement with a semi-colon. It'll make life easier. Some code formatting tools will insert them when they reformat, eg [Red Gate SQL Prompt][2] or [Mladen Prajdic's SSMS Tools Pack][3]. Disclaimer: I'm a Friend of Red Gate (who operate this site), and a friend of Mladen... [1]: https://format-sql.com/ [2]: http://www.red-gate.com/products/sql-development/sql-prompt/ [3]: http://www.ssmstoolspack.com/Features?f=4
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.