Viewing 15 posts - 1,216 through 1,230 (of 7,608 total)
;WITH cte_add_row_nums AS (
SELECT *, ROW_NUMBER() OVER(PARTITION BY Id ORDER BY Branch) AS row_num
FROM #temp
)
SELECT id, branch, city
FROM cte_add_row_nums
WHERE...
October 6, 2021 at 12:57 am
You might be able to use a login trigger to deny the connection for those specific users if they were not coming from a linked server. You'd have to review...
October 5, 2021 at 3:30 pm
NTILE specifies the number of groups, not the size of each group. So in your example it should be 100 not 800.
For the sample data shown, 10 groups makes more...
October 5, 2021 at 1:55 pm
I agree with Phil. I would use a "holding" table to contain the data prior to it being summarized in 15-minute "packets" to be added to the main table.
October 5, 2021 at 1:44 pm
Scott, fyi...I do have a clustered index defined for the column that is the primary key - an IDENTITY column.
[UserId] [int] IDENTITY(1,1) NOT NULL,
CONSTRAINT [PK_User] PRIMARY KEY CLUSTERED (...
October 5, 2021 at 1:34 am
I
[1] To log in, I request a User Name. Should I have a non-clustered index on that column?
[2] Also, in another table, I query on the email address, should...
October 4, 2021 at 8:19 pm
Maybe something like this?:
ALTER TABLE dbo.your_table_name ADD REPORT_DATE AS CAST(DATEADD(DAY, CASE WHEN CREATE_TIME >= '18:00:00' THEN 1 ELSE 0 END, CREATE_DATE) AS date) PERSISTED;
...
WHERE REPORT_DATE = CAST(GETDATE() AS date)
October 4, 2021 at 5:39 pm
Yep, there's not much you can do to speed it up. However, you can be sure to shrink only the specific file(s) you need to shrink, not the entire db. ...
October 4, 2021 at 5:03 pm
Don't use a function against the column, that can make performance worse, potentially much worse.
WHERE CREATE_DATE = (DATEADD(DAY, DATEDIFF(DAY, 0, GETDATE()) - 1, 0) AND CREATE_TIME >=...
October 4, 2021 at 4:53 pm
Database and index reviews cannot be automated. No software now does even a reasonably decent job of doing that. It must be done by a person.
Especially important is determining and...
October 3, 2021 at 5:48 am
That's all the biggest parts of it.
Sometimes you can also need data cardinality info, that is, how many different values / row counts there are for certain columns.
For example, say...
October 2, 2021 at 4:22 am
I have to admit, I really don't know how to debug "it doesn't like it." I'm not even 100% sure what that specifically means.
October 2, 2021 at 4:19 am
ScottPletcher wrote:(Code reformatted but so that it can be read without scanning 50 feet to the right.)
50 feet? Is your browser set to Mr Magoo mode?
Hyperbole.
But, c'mon man, an...
October 1, 2021 at 5:20 pm
Start with data modeling first, so not with "tables"/"columns" but with entities and attributes. Spend some time getting a full list of all data attributes (elements, "columns") that you need...
October 1, 2021 at 4:18 pm
The key thing for performance is likely to be the indexing, and here specifically the clustered indexing.
Both IPS and V should be clustered on ( LocNum, InOrOut, AccountNumber ), in...
October 1, 2021 at 3:46 pm
Viewing 15 posts - 1,216 through 1,230 (of 7,608 total)