Viewing 15 posts - 1,471 through 1,485 (of 7,614 total)
DECLARE @start_year int
DECLARE @start_month char(2)
DECLARE @month_count smallint
SET @start_year = 18
SET @start_month = '01'
SET @month_count = 12
;WITH
cte_tally10 AS (
SELECT * FROM (VALUES(0),(0),(0),(0),(0),(0),(0),(0),(0),(0)) AS numbers(number)
),
cte_tally1000...
June 28, 2021 at 10:12 pm
Solution:
Use COALESCE instead of ISNULL, i.e.:
select COALESCE(nullif('',''),' ')
June 28, 2021 at 2:57 pm
After all these decades. I don't remember why the inmate number was that long. I believe we display the first nine digits because that matches the Social Security number....
June 25, 2021 at 8:53 pm
I just notice this: is there supposed to be a space in the @CustNum value? Just curious. Since that appears to be your own custom data type, it might be...
June 25, 2021 at 8:48 pm
Since all the people who have ever existed fit very comfortably into 12 digits, I can't imagine why you'd need 18 digits for your person id.
June 25, 2021 at 8:30 pm
Interesting behavior. Have not seen that occur "naturally" before.
Edit: Now that I think about it, I thought all changes made w/i a trans were visible to that trans, even if...
June 25, 2021 at 6:04 pm
What I need here is a way to grant execute permission to a role, or grant select permission to role, *at a server level*. Is this impossible?
Maybe not. If...
June 25, 2021 at 5:55 pm
Lets say in 5 years someone makes a stored procedure that should only be run after hours due to the duration and resource usage. Since it should only be...
June 25, 2021 at 4:13 pm
If it would be OK to force the NULL value to be added to lowest date:
;WITH test_data AS (
SELECT col1 = 7213
...
June 25, 2021 at 4:03 pm
I would say the modern approach to doing this is using ROW_NUMBER(), partly because of its inherent efficiency:
SELECT theDate, ID, val
FROM (
SELECT *,...
June 25, 2021 at 4:36 am
(inmate_nbr CHAR(18) NOT NULL PRIMARY KEY, -- required, not optional.
Man... talk about a worse practice ever. If you're going to do something this silly, use a GUID... at...
June 25, 2021 at 4:31 am
SELECT
'DataLake' AS DatabaseName, SchemaName, TableName,
p.Rows AS Row_Count, 'Row count same as yesterday''s row count' AS Message
FROM
DataLake.sys.tables...
June 24, 2021 at 3:23 pm
Doesn't need to be a PK, just the clustering index. The Quality_ID by itself would typically be the (nonclustered) PK.
Create the _test table from scratch. Add the UNIQUE CLUSTERED index...
June 23, 2021 at 10:20 pm
Proper clustering would make the archiving process very fast and easy, since all rows would be contiguous by Quality_Date.
June 22, 2021 at 8:22 pm
If you cluster the table properly -- Quality ( Quality_Date, Quality_ID ) -- you likely won't have to purge them now. That is one of the benefits of properly clustering...
June 21, 2021 at 4:54 pm
Viewing 15 posts - 1,471 through 1,485 (of 7,614 total)