Viewing 15 posts - 1,771 through 1,785 (of 7,608 total)
That seems about right. I'd say also consider doing tables every day that get a manual update in 2 days' time; they're close enough to once-a-day anyway to me. "Better...
March 22, 2021 at 2:36 pm
SELECT ca.name, ca.nentry
FROM (
SELECT
SUM(CASE WHEN '.' + contents + '.' LIKE '%[^A-Za-z]bull[^A-Za-z]%' THEN 1 ELSE...
March 22, 2021 at 2:24 pm
The Windowing functions tend to be extraordinarily efficient, so I'd do the request this way:
SELECT DISTINCT f.[Id] AS [FormId], ver.[FormVersion]
FROM @forms f
LEFT OUTER JOIN (
...
March 22, 2021 at 2:17 pm
In a CASE <condition> THEN <result>, the <result> must be a single value (technically called a "scalar" value). Not allowed are SQL keywords or operators (>=, <) as part of...
March 19, 2021 at 2:08 pm
"Tell" SQL to always use a full table scan for those indexes that need it. Do that by running this one time at your convenience:
-- index_name is optional, of course
UPDATE...
March 19, 2021 at 12:36 am
If necessary, you could even add a DDL trigger as a failsafe to make absolutely sure that user doesn't create (or drop) any tables in that db.
March 18, 2021 at 7:05 pm
Grant the user the db_datareader and db_datawriter roles, etc., using the commands below. You can ignore any errors except those dealing with the user's name:
ALTER ROLE db_datareader ADD MEMBER [your_user_name_here];
ALTER...
March 18, 2021 at 7:01 pm
March 18, 2021 at 1:57 pm
Summing case statements instead of doing a PIVOT, is referred to as a cross tab.
Exactly. I used a CASE in a SUM but not instead of a PIVOT, so...
March 18, 2021 at 1:47 pm
You're likely wasting resources by using a CROSS JOIN. Just do a standard INNER JOIN using the LIKE comparison as the join condition.
March 17, 2021 at 10:29 pm
I can't tell specifically what you want. Here's by best guess without further details from you:
;WITH cte_state_max_sales AS (
SELECT StateCode, MAX(Sales) AS Sales...
March 17, 2021 at 4:23 pm
SQL Server does not automatically determine a row sequence, so you'll need a column in Table B that provides an order, such as an date_inserted or a $IDENTITY column. For...
March 16, 2021 at 1:46 pm
If there's still interest for this, I'd be happy to write an article about Sequences, with: set up; uses, including shared uses across many tables; possible issues; etc..
March 15, 2021 at 9:56 pm
You may not be rebuilding that specific index.
The easiest way to rebuild all indexes on a table is:
ALTER INDEX ALL ON dbo.POHeader REBUILD
March 15, 2021 at 3:15 pm
The linked article states that "If a date is neither a holiday, nor a weekend day, it is a workday." But that's not true. Businesses may be shut because of:...
March 14, 2021 at 2:52 pm
Viewing 15 posts - 1,771 through 1,785 (of 7,608 total)