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.
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)
57 Comments. Leave new
want to find highest salary from emp(eid,department,salary) without using any sql function.
Why do you want not to use anu sql function?
SELECT TOP 1 FROM EMP ORDER BY SALARY DESC
hi jp,
i’m new to dis site…as i m very much interested in learning sql database nd nw i no the basics of sql but not deeper..wat i hav to do to go get strong in sql…
pls advise…
pinaldave pls advise..
Hi Pinal
create Procedure [dbo].[sp_become_acc_reviewer_content]
(
@become_acc_reviewer text,
@action varchar(20)
)
as
begin
if(@action = ‘insert’)
begin
insert tbl_crm_details([become_ an_acc_reviewer])values(@become_acc_reviewer)
End
else
begin
update tbl_crm_details set [become_ an_acc_reviewer]=@become_acc_reviewer
end
end
when i save data in second time its save a new row
what i want to concatenate this
how can i do this
plz give me solution
thanks
What did you mean by concatenation?
hi,
I’m new to sql.I have a problem some one asked in one of my interview.he was asking like this”how to split one table data into two table result set but result should be side by side means
table:
id name sal
1 ravi 1000
2 kishore 2000
3 naveen 3000
4 suresh 4000
resulet:
id name sal : id name sal
1 ravi 1000 : 2 kishore 2000
3 kishore 3000 : 4 suresh 4000
note:result shoud be appears in single window
can any one help me.
Create Table Document
(
DocID Int,
PageID Int,
DocName Varchar(100)
)
Insert into Document values
(1,0,’document Test’),
(1,0,’document Test’),
(1,0,’document Test’),
(1,1,’document Test’),
(1,2,’document Test’),
(1,3,’document Test’),
(1,4,’document Test’),
(1,5,’document Test’),
(1,5,’document Test’),
(2,0,’document Test’),
(2,1,’document Test’),
(2,0,’document Test’),
(3,0,’document Test’),
(3,0,’document Test’)
Hai Sir,
I need a help…
I want to update the duplicate record with maximum of its pageID from the above table without use a loop.
After updation the DocID & PageID combination of record should be unique.
For eg.,
Output will be :
DocID PageID DocName
———————–
1 0 ‘document Test’
1 6 ‘document Test’
1 7 ‘document Test’
1 1 ‘document Test’
1 2 ‘document Test’
1 3 ‘document Test’
1 4 ‘document Test’
1 5 ‘document Test’
1 8 ‘document Test’
2 0 ‘document Test’
2 1 ‘document Test’
3 0 ‘document Test’
3 1 ‘document Test’
Thank you,
Nikhildas
Cochin
Dave Sir Can you gives us reference books for oracle OCA certification books
Hai Pinal sir,
Can we store a static value in sql server without table?
Hi,
In table one column passport field is there it allows only unique values at same time it allows more than two nulls ( i know unique only allow only one null value for example in college more than two students does not have passport at that time it allows null values at the same time who have passport that id must be unique. is it possible can anybody knws plz send snd answer.
can anyone help me with this please. . . thanks! !
iii. The report can be sorted by Vendor #, Purchase Order # or Item #
1. If sorted by Vendor #
a. Group Header: Vendor # (Company Name)
b. Details (in this order): PO #, Request Date, Warehouse, Item #, Unit of Measurement, Order Qty, Unit Cost, Discount Rate, Ext. Net Cost
2. If sorted by Purchase Order #
a. Details (in this order): PO #, Vendor #, Request Date, Warehouse, Item #, Unit of Measurement, Order Qty, Unit Cost, Discount Rate,
3. If sorted by Item #
a. Group Header: Item # (Description)
b. Details (in this order): Warehouse, PO #, Vendor #, Request Date, Order
how to use LOB data type in oracle database creation. and how to retrive those columns>
Hi
Should we use Singular or Plural Database Table Names??
Thanks
Vijayakumar P
Hi,
I am having a Question regarding to Database mail, the client requriment is that he must receive the mail in Excel format, without using SSIS packages,can you please give me sugguest me regarding may I get in script form and through GUI.
Thanks & Regards
Murali
Can you help me in this issue.
I need to have conditional operators inside the case for each case
I rely on this document quite a bit, but the download is broken. Can you put it back up?
Hi Pinal,
It seems the download link is not working…
can you update it pls?
thanks
Krunal.
What i do not understood is if truth be told how
you’re now not actually a lot more smartly-liked than you might be
now. You are very intelligent. You realize therefore considerably
in relation to this topic, made me for my part consider it from
a lot of various angles. Its like men and women are not
fascinated unless it is one thing to do with Lady gaga! Your own stuffs excellent.
Always deal with it up!
Thanks for finally talking about >SQL SERVER – Guidelines and Coding Standards Complete List Download | Journey
to SQL Authhority wikth Pinal Dave <Liked it!
Hello ,
I have 2 Applications say APP1 and APP2
APP1 database fetches the data , following is the structure of data:
dataabse name: APPDB1
ID Name Value
1 Hostname Lab_Client1
2 Hostname Lab_Client2
3 OS Windows 8
4 OS Windows 7
5 IP Address 10.0.1.2
6 IP Address 10.0.1.3
I want to import this data in APPDB2 in following Manner:
ID Hostname OS IP Address
1 Lab_Client1 Windwows 8 10.0.1.2
2 Lab_Client2 Windwows 7 10.0.1.3
The Data imported from APP1 with DB name APPDB1 is updated automatically when clients have some change in information.
Please help me with the script to create database say APPDB2 which will import all the data in Example 2 fashion and should update if any change is there in APPDB1
Great post.
Hello to every , for the reason that I am really eager of reading this blog’s post to be updated regularly.
It contains good data.