Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

What is the accepted practice?
As a c# refugee, I was wondering what was the accepted practice in the
SQL world:

Scenario 1:
if (1 = 2) begin
..
end

Scenario 2:
if (1 = 2)
begin
..
end

Thanks

Report this thread to moderator Post Follow-up to this message
Old Post
Frank Rizzo
01-30-06 01:23 AM


Re: What is the accepted practice?
I don't know if there is an "Accepted" practice but I see it most often like
#2.  Personally I prefer that as well since it is easier to read and debug.

--
Andrew J. Kelly  SQL MVP


"Frank Rizzo" <nospam@nospam.com> wrote in message
news:uv9ua6RJGHA.3944@tk2msftngp13.phx.gbl...
> As a c# refugee, I was wondering what was the accepted practice in the SQL
> world:
>
> Scenario 1:
> if (1 = 2) begin
> ...
> end
>
> Scenario 2:
> if (1 = 2)
> begin
> ...
> end
>
> Thanks



Report this thread to moderator Post Follow-up to this message
Old Post
Andrew J. Kelly
01-30-06 01:23 AM


RE: What is the accepted practice?
I always go with
if 1=2
begin
...
end
else
begin
...
end



"Frank Rizzo" wrote:

> As a c# refugee, I was wondering what was the accepted practice in the
> SQL world:
>
> Scenario 1:
> if (1 = 2) begin
> 	...
> end
>
> Scenario 2:
> if (1 = 2)
> begin
> 	...
> end
>
> Thanks
>

Report this thread to moderator Post Follow-up to this message
Old Post
Nigel Rivett
01-30-06 01:23 AM


Re: What is the accepted practice?
I'll third what Andrew and Nigel said, and add to that the importance of
indentation:

IF (1=2)
BEGIN
--Indenting makes this much easier to identify as something nested
END
ELSE
BEGIN
--Here, too...
END


--
Adam Machanic
Pro SQL Server 2005, available now
http://www.apress.com/book/bookDisplay.html?bID=457
--


"Frank Rizzo" <nospam@nospam.com> wrote in message
news:uv9ua6RJGHA.3944@tk2msftngp13.phx.gbl...
> As a c# refugee, I was wondering what was the accepted practice in the SQL
> world:
>
> Scenario 1:
> if (1 = 2) begin
> ...
> end
>
> Scenario 2:
> if (1 = 2)
> begin
> ...
> end
>
> Thanks



Report this thread to moderator Post Follow-up to this message
Old Post
Adam Machanic
01-30-06 01:23 AM


Sponsored Links





Last Thread Next Thread
Post New Thread

MS SQL Server archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 04:38 AM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006