compare nullable param to non-nullable column [closed] - sql-server

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 months ago.
Improve this question
I have a non-nullable bit column and in my Select statement I would like to only compare it with a nullable param if that nullable param is not null. What's the best way of doing this? There are other conditions in the where clause though I would still like to execute.

This sounds like a typical "kitchen sink" kind of query. It would help your question if you provided some details other than a vague explanation. I think you are looking for something like this.
and (#YourParam is null OR [YourBit] = #YourParam)

Related

SQL Server - Index Seek: count of operation [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
In SQL Server we have Index Seek operator. Which works very well for a search operation.
How much operation SQL Server needs to perform in order to get a value? I assume that it should be the height of the tree.
Nobody can say the one answer for sure because it depends on many parameters :
Index type (Clusted, None Clustered)
Unique or Not
Null or Not Null
Expected rows stored in which page
So, there is the well-explained article about index seeking [O2] blow:
https://sqlserverfast.com/epr/index-seek/

Naming multi syllables field in a table [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
Sometimes I want to name a field in a table and this field is composed of a number of syllables!
I wonder how to select the most meaningful name in that case.
For example:
number of successions.
number of weekends
Should I write it:
NumberOfSuccessions
NumOfSuccessions
NumberSuccession
SuccessionNumbers
I care about my attribute naming because I'll deliver this to another developer and I want to get it smoothly.
You should select the first one, i.e. "NumberOfSuccessions" as that looks neat. It is always good to avoid short forms and keep the name as simple as plain english, wherever possible. Also avoid spaces as you have already done, just to make life simple.

Clarification on SQL PIVOT [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
Can someone tell me what is missing in the second Pivot example. It returns NULL http://sqlfiddle.com/#!3/2b405/2
This is the literal answer:
There is no Car, Truck or Bicycle in your vehicle_parameters table. Nothing is missing in your statement, your result of NULL is correct.
Here are some other samples of PIVOT you may want to look up: https://technet.microsoft.com/en-us/library/ms177410%28v=sql.105%29.aspx
I think they explain dealing with nulls well.

Different keyword in sql [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
What is 'PROBLEM:' keyword in sql?
How to use it?
Basically I have seen this keyword in a sql query. But whenever I going to search about this keyword, then everyone posted a reply to get rid from problem in sql. But the main problem is, I failed to make understand to others that, "Problem:" is a keyword.
And this is the main problem. So can anyone describe about this keyword
A word preceding a colon is a label used by goto (https://msdn.microsoft.com/en-us/library/ms180188.aspx)
"PROBLEM" is not a reserved word.

What is the reason to use a suffix on database table and/or column names? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
This question is out of pure curiosity.
Why do some systems and frameworks adopt a suffix on table and/or column names?
Example: the Activiti framework for business process uses the _ character at the end of every column name (ID_, VERSION_, NAME_, ...). I have notice that in some other systems as well.
I'm sure there is a good reason for that.
This is a convention for using names that can be saved words. When you want to call column "from" you can use "from_" because "from" is saved word of SQL.

Resources