SQL SERVER – Guidelines and Coding Standards Complete List Download

SQL SERVER - Guidelines and Coding Standards Complete List Download codeicon Coding standards and guidelines are very important for any developer on the path to a successful career. A coding standard is a set of guidelines, rules and regulations on how to write code. They should be flexible enough or should take care of the situation where they should not prevent best practices for coding. They are basically the guidelines that one should follow for better understanding.

The concept behind implementing these guidelines, is that the consistency and uniformity in programming so that if multiple people are working on the same code, it becomes easier to communicate, share with or understand each other’s work.

With the goal of promoting good coding standards and guidelines I have created a document which can guide developers.

Solarwinds

SQL SERVER – Guidelines and Coding Standards Part – 1

SQL SERVER – Guidelines and Coding Standards Part – 2

Guidelines and Coding Standards complete List Download

Additionally, if you want any other guidelines to be added to this list, please let me know via a comment here so I can add them to the list eventually. I personally follow the standards listed in the document and I also make sure that I follow that at all my customer’s place.

Reference: Pinal Dave (https://blog.sqlauthority.com)

Solarwinds
, , , , , , , , , , , , , , , ,
Previous Post
SQL SERVER – Guidelines and Coding Standards Part – 2
Next Post
SQL SERVER – Get Answer in Float When Dividing of Two Integer

Related Posts

57 Comments. Leave new

  • Hi,
    the direct links to part 1 & 2 above both have typos

    SQL SERVER – Guidelines and Coding Standards Part – 1
    Should be https://blog.sqlauthority.com/2008/09/23/sql-server-coding-standards-guidelines-part-1/
    (Not 09/22)

    SQL SERVER – Guidelines and Coding Standards Part – 2
    Should be https://blog.sqlauthority.com/2008/09/24/sql-server-coding-standards-guidelines-part-2/
    (Not 09/23)

    Reply
  • Hello Dave,

    I’m having two tables

    Table1: Table2:

    ID Date Month Jan Feb Mar Remarks

    1 1 Jan xx xx xx xxxxx

    2 14 Jan xx xx xx xxxxx

    3 26 Jan xx xx xx xxxxx

    4 14 Feb xx xx xx xxxxx

    5 13 Mar

    I want distinct values of Month in Table1 to be the Column Name of Table2 as above said:
    can you help me out

    Thanks & Regards
    Surendar K

    Reply
  • Hello Dave,

    I want distinct values of Month in Table1 to be the Column Name of Table2 as below dynamically

    Table1:

    ID Date Month

    1 1 Jan

    2 14 Jan

    3 26 Jan

    4 14 Feb

    5 13 Mar

    Table2:

    Jan Feb Mar Remarks

    Thanks & Regards
    Surendar K

    Reply
  • hi..
    i want count all rows with group by and also count some specific rows with same group by statement.

    department total_Emp waitng_list Joind_Emp
    —————————————————————————
    ABCD 50 10 40
    CDEF 20 10 10

    Reply
    • Apply this logic

      select department,count(*) as total_emp,sum(case when status=’waiting list’ then 1 else 0 end) as waiting_list from table

      Reply
  • i want need how to change to password in sql server 2005 to run vb 6.0.

    my project not connection to change password in sql server 2005 not run in visual basic 6.0

    Reply
  • Hi,

    Deve,

    used adventureworks
    select * from sys.tables

    I am using these code to retrieve all tables name.
    it works but “Name” column field not showing full table name like “person.address”.
    Plz help me how can i retrieve full name of table.

    Thanks

    Reply
    • In person.address, the name person is a user name who created the name. Only address is the actual table name

      Reply
  • Please tell me about data vault? I don’t know anything about the same. where can i find out docs?

    Reply
  • CREATE FUNCTION employees_in_project
    (@pr_number varchar(20))
    RETURNS TABLE
    AS
    RETURN (SELECT Sum(Amount) as Amount
    FROM MasterDetail
    WHERE MasterDetail.code = @pr_number)
    GO

    In Analizer

    SELECT *, employees_in_project(master.code ) as Amount FROM Master
    GO

    it not work what is error in query

    Reply
  • Hi Shaikh,

    As this is table-values function, you can not call it like this way.

    You need to access it as:

    SELECT *
    FROM TableName master
    CROSS APPLY employees_in_project(master.code)

    Tejas

    Reply
  • Hi,
    I am new user.
    This Question asked me in HCL tech.
    My Ques. is how can see database?

    Reply
  • Hello Ravi,

    Do you want to see databases list in SSMS then use sys.databases catalog view.
    If this is not what you want to know then please clarify your question.

    Regards,
    Pinal Dave

    Reply
  • hi sir i m first use the primary key and then i m remove it
    but there after removing primary key the only duplicate key allowed and null is not allowed in the table pls tell me how to allowed duplicate and null in table

    Reply
  • hi sir i m using sql 2005. and my sir challege me for that ?
    pls sir give me the reply

    Reply
  • Hi Amit,

    When we drop a primary key constraint from a table the NOT NULL property of column is not changed. To allow null make sure that column is nullable. Check the result of sp_help tableName command and if you found Nullable “no” then alter the table to allow null using below syntax:

    ALTER TABLE tableName ALTER COLUMN columnName dataType NULL

    Regards,
    Pinal Dave

    Reply
  • Hi amit,

    Use this syntax for ur question

    ALTER TABLE tableName ALTER COLUMN columnName dataType NULL

    Reply
  • How to Pass a bulk of data from .net to sql server, i mean pass a datatable values from .net to sqlsever 2005 for insert into table, to avoid for loop of calling insert query function

    Reply
  • hi..

    i’m new here.

    here is my question.

    there is a employee table.

    I’ve to get the employee’s highest salary as well as corresponding name from that table.

    could you please tell the Query for that

    thanks…

    kanagavel.N

    Reply
  • Hi Pinal ,

    Can we move the system database to some other location at the time of installating sql server 2005 . These was a interview question asked from me by a company ?

    Thanks and Regards
    Ashish Gupta

    Reply
  • Kanagavel,

    Assuming that your table has duplicate employee names but unique employee IDs, the following query should give you the result:

    SELECT EMPID, EMPLOYEENAME, MAX(SALARY)
    FROM EMPLOYEE_TABLE
    GROUP BY EMPID, EMPLOYEENAME
    ORDER BY EMPID

    Reply
  • Most likely there will be only one salary amount associated with en employee ID, Employee combination. However, assuming that you just need to find which employee name draws the highest salary, this query should help:

    select top 1 employeename, MAX(salary)
    from Employeetable
    group by employeename
    order by MAX(salary) desc

    Reply

Leave a Reply

Menu