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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:03:55+00:00 2026-05-13T13:03:55+00:00

My primary concern is with SQL Server 2005… I went through many website and

  • 0

My primary concern is with SQL Server 2005… I went through many website and each tells something different.

What are the scenarios that are good / ok to use.. For example does it hurts to even set variable values inside IF or only if I run a query. Supposing my SPs is building a dynamic SQL based of several conditions in Input Parameters, do I need to rethink about the query… What about a SP that runs different query based on whether some record exists in the table. etc.. etc.. My question is not just limited to these scenarios… I’m looking for a little more generalised answer so that I can improve my future SPs

In essense… Which statements are good to use in Branching conditions / Loops, which is bad and which is Okay.

  • 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-05-13T13:03:56+00:00Added an answer on May 13, 2026 at 1:03 pm

    Generally… Avoid procedural code in your database, and stick to queries. That gives the Query Optimizer the chance to do its job much better.

    The exceptions would be code that is designed to do many things, rather than making a result-set, and when a query would need to join rows exponentially to get a result.

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

Sidebar

Related Questions

Suppose I have an SQL Server 2005 table, TableX, with 2 indexes on it:
I'm renovating an existing ASP.Net web-app which has a full-fledge functional SQL 2005 DB
I'm in the process of designing a fairly complex system. One of our primary
Setup: I'm creating a .NET WinForms application in C# to allow our technical support
I am looking to purchase a new development PC. My budget is not more
My project when it is running, will collect a large number of string text
Our current Intranet environment is a little outdated. The current stack has ASP.NET 1.1/2.0
Question: Should I write my application to directly access a database Image Repository or
Update 2009.04.24 The main point of my question is not developer confusion and what

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.