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 7922293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:54:05+00:00 2026-06-03T16:54:05+00:00

Are BEGIN/END needed in SQL scripts (in general) or is it fine to replace

  • 0

Are BEGIN/END needed in SQL scripts (in general) or is it fine to replace them with { and }

Example:

IF DB_ID('comics') IS NOT NULL        
    BEGIN
        PRINT 'Database exists - dropping the comics database.';
        DROP DATABASE comics;
    END

VS

IF DB_ID('comics') IS NOT NULL        
{
    PRINT 'Database exists - dropping the comics database.';
    DROP DATABASE comics;
}

I am using MS SQL Server 2008 R2

  • 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-06-03T16:54:08+00:00Added an answer on June 3, 2026 at 4:54 pm

    The documentation for IF...ELSE shows:

    IF Boolean_expression 
         { sql_statement | statement_block } 
    [ ELSE 
         { sql_statement | statement_block } ] 
    

    However, the Transact-SQL Syntax Conventions (Transact-SQL) page shows:

    { } (braces)    Required syntax items. Do not type the braces.
    

    So, the braces aren’t something that you can enter in your code, but instead are simply showing that there is exactly one sql_statement or statement_block required in an IF statement. (Of course, a statement_block can contain multiple sql_statements as long as you use BEGIN and END around them.)

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

Sidebar

Related Questions

Is it possible to have php not to require the begin/end tags ( <?php
I have the below Declare @tbl Table(Id int identity, SomeCol varchar(10) not null) Begin
I'm in the middle of sorting out a nested set of if/then begin/end pairs,
Since the nonmember begin() and end() functions were added for standard contains in the
I'm using the following snipped to find the begin and end of several time
how to remove char () from the begin and the end of a string
I want to match expressions that begin with ${ and end with } in
if you know the start and end positions in string from where to begin
It seems like I have begin ... rescue ... end statements everywhere in my
I have a loop for(aI = antiviral_data.begin(); aI != antiviral_data.end();) { for(vI = viral_data.begin();

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.