Viewing 15 posts - 481 through 495 (of 7,597 total)
SELECT
SUM(CASE WHEN t.create_date BETWEEN @v_from_date AND @v_to_date THEN t.max_column_id_used ELSE 0 END) AS tables_created,
SUM(CASE WHEN t.modify_date BETWEEN @v_from_date...
March 16, 2023 at 2:49 pm
In certain cases or usage situations, SQL Server will require a primary key. One reason is that a primary key is guaranteed to be unique and non-NULL (that is, by...
March 16, 2023 at 2:16 pm
Can you explain further why you want to allow this user to enable/disable system versioning? As far as I am aware - the only reasons to temporarily disable versioning...
March 15, 2023 at 9:42 pm
No. Performance-wise they are exactly the same.
March 15, 2023 at 7:29 pm
To get durations beyond 12 hours, I think you can just do:
WHERE h.run_duration > 120000
March 15, 2023 at 5:54 pm
If the proc as an appropriate "EXEC AS" clause, I would think it would work.
March 14, 2023 at 6:40 pm
Yes, in theory you should be able to use just a WHERE clause and "HAVING COUNT(*) < 3", but I don't like to assume that there aren't duplicate description entries.
Also,...
March 13, 2023 at 9:53 pm
SELECT ID
FROM ExampleTable
WHERE Description IN ('Apex', 'BILL', 'SIERRA')
GROUP BY ID
HAVING MAX(CASE WHEN Description = 'Apex' THEN 1 ELSE 0 END) = 0 OR
MAX(CASE...
March 13, 2023 at 3:31 pm
I think adding the WeekDay and Hour columns to the main table make the most sense. Computed columns will be more efficient than a trigger, but they do have some...
March 6, 2023 at 9:09 pm
The current approach seems ok to me, as long as people are rigorous about changing the status to "Declined" or "Cancelled" if the day can't be taken as scheduled.
March 6, 2023 at 6:41 pm
I believe it's acceptable to use either singular or plural names for database table names,
Acceptable, perhaps. But can you name any major RDBMS...
March 6, 2023 at 3:58 pm
It's possible that creating your own statistics would help SQL here, but without more details, it's impossible to say what stats to create.
March 6, 2023 at 2:56 pm
;WITH cte_last_visits AS (
SELECT client_id,
MAX(visit_date) AS last_visit,
...
March 3, 2023 at 2:27 pm
(less than 8 pages goes on mixed extents
For SQL 2017 (or SQL 2016, for that matter), only if for some odd reason you've set MIXED_PAGE_ALLOCATION ON and/or allowed...
March 2, 2023 at 11:13 pm
I believe it's acceptable to use either singular or plural names for database table names,
Acceptable, perhaps. But can you name any major RDBMS that uses...
March 2, 2023 at 9:19 pm
Viewing 15 posts - 481 through 495 (of 7,597 total)