Viewing 15 posts - 601 through 615 (of 2,645 total)
Except for the occasional Indexed View, this is one of the many reasons why I hate views.
Instead, try a "parameterized inline view" better known as an "Inline Table Valued...
January 4, 2023 at 1:23 am
This will identify rows that don't match:
SELECT [D1].[RowID] AS [D1_RowID],
[D1].[PairID] AS [D1_PairID],
[D1].[SequenceInt] AS...
January 1, 2023 at 2:37 am
Is this solution is only good if there are no dates falling on weekends?
what mention of weekends? there is nothing on the original OP post that mentions it...
December 31, 2022 at 4:31 pm
Is this solution is only good if there are no dates falling on weekends?
December 31, 2022 at 11:26 am
@frederico_fonseca I had the same idea as you initially, but your solution will not work either. What if there were 20 groups instead of 3? What if the gaps...
December 30, 2022 at 6:40 pm
I think the query can be simplified to this:
SELECT @RowCount = COUNT(*)
FROM Quality q (NOLOCK)
WHERE (q.Quality_Date <= DATEADD(DAY, @Interval,GETDATE())
...
December 30, 2022 at 5:30 pm
This is probably the fastest code but a bit long winded
declare @Delimiter char(1) = '/'
;with cte as
(
select 'Invoice/14/248/TD C/O BGIS/20009. 1/ 16566/JB App...
December 30, 2022 at 5:09 pm
Also convert '12/31/9999' to a proper date-type for comparison
In Belgium this would read as the 12th of month 31 in the year 9999
In the UK too
December 30, 2022 at 10:18 am
Got it.
select 'LOAD DATA INFILE ''db/'+name+'.txt'' INTO TABLE '+name+'('+STRING_AGG(COLUMN_NAME,',')+');'
from tbl_column_length C left join sysobjects S on C.TABLE_NAME=S.name
where type='u'
and length <100
and name in('table1')
group by name
That...
December 27, 2022 at 10:38 pm
Definitely use char(2) for the values, as suggested (varchar requires two bytes of extra overhead (to store length) per column).
If they're not already encoded, encode the names. That is,...
December 26, 2022 at 8:02 pm
I think I would resort to the RBAR cursor method:
DROP TABLE IF EXISTS #Results;
CREATE TABLE #Results(Score int, ActivationTime datetime, Grp int, BaseDate date)
DECLARE @Score int, @ActivationTime datetime
DECLARE...
December 26, 2022 at 3:35 pm
Yes and the Value field is varchar(02), it needs to hold "1", "2", or "NA".
It would save 2/3rds of the memory required if it could be...
December 25, 2022 at 11:17 pm
Yes and the Value field is varchar(02), it needs to hold "1", "2", or "NA".
It would save 2/3rds of the memory required if it could be a numeric...
December 25, 2022 at 12:12 am
The maximum row size in SQL Server is 8,060 bytes. If you get near this then you might come across performance problems with page splits when updating rows. For this...
December 24, 2022 at 6:18 pm
It's for a clinical situation. I guess later it can be delivered as a .csv. For now my manager wants to review data and he wants to see it...
December 24, 2022 at 5:37 pm
Viewing 15 posts - 601 through 615 (of 2,645 total)