Viewing 15 posts - 1,876 through 1,890 (of 7,616 total)
If you do create a tally table, page compress it at 100 fillfactor. That will save significantly on the overhead of reading the table. And, since that table is static,...
February 19, 2021 at 7:22 pm
In SQL Server, the CASE WHEN/THEN results are scalar (single) values only: keywords, operators, etc. are not allowed. Thus, you need something more like below.
Edit: That said, the expressions within...
February 19, 2021 at 7:05 pm
SQL works based on tables. By definition, a SQL Server table must have a name.
To look at my own version of this:
SELECT * FROM (VALUES(0),(0),(0),(0),(0),(0),(0),(0),(0),(0)) AS numbers(number)
The VALUES clause is...
February 19, 2021 at 3:57 pm
Nvm, OOPS, I posted this same code earlier.
February 18, 2021 at 10:16 pm
SET ANSI_NULLS ON;
SET QUOTED_IDENTIFIER ON;
GO
ALTER FUNCTION [DP].[GetYears] ( @StartYear AS INT )
RETURNS TABLE
AS
RETURN
WITH
tally10 AS (
SELECT * FROM (VALUES(0),(0),(0),(0),(0),(0),(0),(0),(0),(0)) AS numbers(number)
),
tally1000 AS (
...
February 18, 2021 at 9:31 pm
You can change the default file locations when installing SQL Server. You can also move the system databases later if you want to.
I have always found this to...
February 18, 2021 at 8:20 pm
After the 30 days, move them to some type of historical table. Personally I would never permanently delete such data. Compress it to the max and it will take very...
February 18, 2021 at 8:18 pm
DECLARE @StartYear SMALLINT = 2017;
SELECT DATETIMEFROMPARTS(@StartYear + number, 1, 1, 0, 0, 0, 0) AS StartDate,
@StartYear +...
February 18, 2021 at 8:15 pm
Not enough details to get very specific, obviously.
However, this rules will always apply:
1. Create the clus index on all temp tables before loading them. There are techniques for doing this...
February 18, 2021 at 7:13 pm
What about opportunity cost? The tally is used here to gen years, so the number is inherently very small and will always be so. It is really worth the time...
February 18, 2021 at 7:04 pm
There's no need for anything remotely close to that number of rows (exceeding 2B for l5) for years
But what if I need to know...
February 18, 2021 at 6:10 pm
In general, agreed. Although that specific implementation of an inline tally table is, frankly, horrible. There's no need for anything remotely close to that number of rows (exceeding 2B for...
February 18, 2021 at 5:27 pm
would be nice to have something like this i guess, sucks it doesnt work
create table #table
(old_column int)
insert into #table
values(1),(2)
alter table #table
add new_column int default (case when...
February 18, 2021 at 5:18 pm
You can change the default file locations when installing SQL Server. You can also move the system databases later if you want to.
February 18, 2021 at 5:14 pm
Use ENCRYPTBYASYMKEY and DECRYPTBYASYMKEY.
February 17, 2021 at 5:31 am
Viewing 15 posts - 1,876 through 1,890 (of 7,616 total)