Viewing 15 posts - 1,441 through 1,455 (of 2,645 total)
Jonathan, what do you mean by "you can just add a unique constraint or index to any column that should be unique?" What is the purpose? Putting a UK...
August 20, 2019 at 12:16 am
And here is the DDL (I think)
With one exception, all of the VARCHAR columns in that table are VARCHAR(MAX), which is a LOB datatype. That's the first thing...
August 20, 2019 at 12:11 am
The query will remain the same, the optimiser will work out it needs to use it.
So just run the statement:
CREATE INDEX IX_DocumentLog_1 ON elliedb.DocumentLog(Title, OrderDateUtc)
INCLUDE (Company,...
August 19, 2019 at 7:21 pm
SQL Server thinks the suggested index will make a big difference. There might be more than one index needed but you'll need to look at the "missing indexes" section of...
August 19, 2019 at 7:13 pm
To avoid any IF / CASE logic, I usually use this technique instead:
SIGN(Jan) + SIGN(Feb) + ...
If situations where the numbers could ever be negative, you'd need to include...
August 19, 2019 at 6:41 pm
The Table has just under 2 million rows (1958393), and takes 32:08 to fully query every row and column. Does SQL go through the table line by line and...
August 19, 2019 at 6:38 pm
Sorry, it looks like the end of my post was somehow truncated.
I meant to say that UNION ALL is more efficient than UNION as...
August 19, 2019 at 6:33 pm
It could be something as simple as there are more than 1000 near the top of the table that satisfies the query and the 10,000th row is a long way...
August 19, 2019 at 5:02 pm
Sometimes
select * from test where col_value = 'a'
union all
select * from test where col_value = 'b';
August 19, 2019 at 4:55 pm
I believe that the natural unique identifier is a safety net for the application to prevent duplicate data that is hard to unravel when different records (different surrogate keys)...
August 19, 2019 at 10:32 am
It would be helpful if you could supply the query the DDL for the table(s) definitions and any indexes on the table(s).
Also the execution plan of the query when selecting...
August 18, 2019 at 3:40 pm
I think you can do it by changing your LEFT JOINs to be OUTER APPLY and selecting TOP(1) within it.
FROM #DataExtract t1
OUTER APPLY(SELECT TOP(1)...
August 16, 2019 at 5:23 pm
I'm not at all sure what your requirement is but if you want to show multiple rows on one row then you need to use a FOR XML PATH statement...
August 16, 2019 at 3:43 pm
Hi
could you explain how you worked out that
CREATE INDEX IX_Table1_1 ON Table1(Column2, DateTime)
would be a useful index
Thanks Alex
Just by looking at the join:
tab1.Column2 = Database1.Schema1.Table1.Column2
AND...
August 16, 2019 at 11:06 am
I would try these two indexes:
CREATE INDEX IX_Table1_1 ON Table1(Column2, Column3, DateTime) INCLUDE (Id)
-- On Database 1
CREATE INDEX IX_Table1_1 ON Table1(Column2, DateTime)
Also change the...
August 16, 2019 at 9:45 am
Viewing 15 posts - 1,441 through 1,455 (of 2,645 total)