|
|
-
Sergejack knew 1 Years ago through Just Learned | 1 Point
Sometimes it happens that we need random row (or set of randoms rows) from table.
Itzik Ben-Gan shows us, in one of his book, the efficient way to do this:
SELECT TOP(1) FROM someTable ORDER BY NEWID()
Changing the val...
|
-
Sergejack Liked 1 Years ago through Just Learned | 1 Point
Sometimes it happens that we need random row (or set of randoms rows) from table.
Itzik Ben-Gan shows us, in one of his book, the efficient way to do this:
SELECT TOP(1) * FROM someTable ORDER BY NEWID()
Changing the v...
|
-
Sergejack knew 1 Years ago through Just Learned | 1 Point
Sometimes it happens that we need random row (or set of randoms rows) from table.
Itzik Ben-Gan shows us, in one of his book, the efficient way to do this:
SELECT TOP(1) * FROM someTable ORDER BY NEWID()
Changing the v...
|
-
Sergejack Liked 1 Years ago through Just Learned | 1 Point
In SQL Server Management Studio, we can select text and press SHIFT+CTRL+U and SHIFT+CTRL+L to change the selected text to upper case and lower case respectively. I have been looking for a similar option in Microsft word and just learned that this ca...
|
-
Sergejack Learned 1 Years ago through Just Learned | 1 Point
In SQL Server Management Studio, we can select text and press SHIFT+CTRL+U and SHIFT+CTRL+L to change the selected text to upper case and lower case respectively. I have been looking for a similar option in Microsft word and just learned that this ca...
|
-
Sergejack Liked 1 Years ago through Just Learned | 1 Point
In SQL Server Management Studio, we can select text and press SHIFT+CTRL+U and SHIFT+CTRL+L to change the selected text to upper case and lower case respectively. I have been looking for a similar option in Microsft word and just learned that this ca...
|
-
Sergejack Learned 1 Years ago through Just Learned | 1 Point
In SQL Server Management Studio, we can select text and press SHIFT+CTRL+U and SHIFT+CTRL+L to change the selected text to upper case and lower case respectively. I have been looking for a similar option in Microsft word and just learned that this ca...
|
-
Sergejack Commented 1 Years ago through Just Learned | 1 Point
I don't think it's only relative to comparisons involving a constant.
For instance, I call such a clause NON SARGABLE as well:
SELECT
[...]
WHERE DATEPART(YYYY, Table1.MyDate) = Table2.Year -- Where MyDate is indexed
But this one is (still acco...
|
-
Sergejack Commented 1 Years ago through Just Learned | 1 Point
I don't think it's only relative to comparisons involving a constant.
For instance, I call such a clause NON SARGABLE as well:
SELECT
[...]
WHERE DATEPART(YYYY, Table1.MyDate) = Table2.Year -- Where MyDate is indexed
But this one is (still acco...
|
-
Sergejack Liked 1 Years ago through Just Learned | 1 Point
I have always heard about the terms sargable and non-sargable but never really understood how they help in developing efficient sql code. Here is what I have found out...
Try to avoid WHERE clauses that are non-sargable. The term “sargable” (which i...
|