Viewing 15 posts - 1,906 through 1,920 (of 7,608 total)
If you tell us what you consider to be a "week" -- as we asked for several times -- we could give you code specific to your needs.
I wouldn't rely...
February 9, 2021 at 4:17 pm
Well, obviously, I don't consider it "stupid". Remember, the DELETEs are almost twice a minute. If the table has to be scanned in order to do the deletes, that would...
February 9, 2021 at 3:46 pm
You're welcome. Yeah, SQL requires the alias name (the "AS" is not required, I just like to use it but the "any_name" part is required).
February 8, 2021 at 6:58 pm
You need parentheses to "tell" SQL you're using a subquery in the SELECT:
SELECT * INTO temp_Weekly_Event_Report FROM
(
SELECT
DISTINCT column1 FROM [SQLDatabase].[dbo].[Table] WHERE Event_Source = 1
) AS any_name
February 8, 2021 at 6:46 pm
I strongly object to starting with table structures. Data normalization is a logical process, tables don't exist yet. It's all about the data itself. One should be referencing entities and...
February 8, 2021 at 5:26 pm
They have a query that runs 2400+ times a day using that column to DELETE from the table -- I stick with my recommendation, cluster the table first by that...
February 8, 2021 at 5:20 pm
Always use IFI unless you have disk data that you really can't have anyone else see via some type of hack.
Data pages do not need to be zeroed out before...
February 5, 2021 at 9:04 pm
I think it can be simplified a bit, while also allowing for another value to be found in the future (maybe 'null'?):
SELECT
LongString,
...
February 5, 2021 at 9:02 pm
Most likely that's still best.
Btw, do you know for certain that a given product only occurs once on each order?
February 5, 2021 at 4:18 pm
Actually, in ISO week, week# is controlled by Thursday being in the week. (Seriously, you can look it up.)
So, since this year happens to start on a Friday, ISO week...
February 5, 2021 at 4:08 pm
I think SQL Server loosened up on that. I believe you just need a unique index to create a FK against.
February 4, 2021 at 8:06 pm
It seems like you're doing a straightforward counting of 7 days as a week, regardless of the staring day of the week (SQL doesn't do that), then try this calc...
February 4, 2021 at 7:19 pm
Nope, not unless you do it yourself in some way.
February 4, 2021 at 7:05 pm
Hmm, yeah, I would think that would give you a lot of old customers, since there's no "recent sale date" requirement. Maybe you need something more along these lines...?
February 4, 2021 at 6:59 pm
Assuming "dates" could only be a number between 1 and 31...
DECLARE @UnitMembership TABLE
(
...
February 3, 2021 at 5:58 pm
Viewing 15 posts - 1,906 through 1,920 (of 7,608 total)