Viewing 15 posts - 4,651 through 4,665 (of 7,597 total)
Yep. NULLs can invalidate NOT IN logic. Add a check to eliminate NULLs from the subquery:
SELECT COUNT(1)
FROM dbo.Token TD WITH ( NOLOCK )
WHERE ...
November 9, 2015 at 11:38 am
This may give you some ideas. I used a placeholder of <your_tally_table> for the tally table. Replace that with your own tally table name, either a physical tally...
November 9, 2015 at 11:35 am
In SQL Server, you'd need brackets around the name "Add":
Select l.[add], l.phne
from e_lkup l
where mins is null
GROUP BY phne, [add]
HAVING count(*) >1
EXCEPT
select l.[add], l.phne
from s_status ss
left outer...
November 9, 2015 at 11:04 am
I don't think so. I use that style all the time to rename files (yes, I should use Windows directly, but I'm used to working from within SQL :)...
November 6, 2015 at 9:54 am
Yeah, that drives you crazy until you figure it out, since SQL doesn't always clear out the job activity queue. You have to join to another control table to...
November 6, 2015 at 9:41 am
SET @CMD='ren "\\pashare\shared\dhsr data\Adolescent Health\IMG\PHI_Refresh\export_file_IMG.xlsx" "export_File_IMG_' +@date+'.xlsx"'
(Assuming date is a char data type and thus doesn't need CAST to char).
November 6, 2015 at 9:35 am
Can you give us the DDL for dbo.Cache and/or the query plan for:
UPDATEdbo.Cache
SETAvailability = Availability - 1,
LastUpdated = GETUTCDATE()
WHEREUnitId = @UnitId
ANDStartDate < DATEADD(DAY, @Duration, @StartDate)
AND@StartDate < DATEADD(DAY, Duration, StartDate)
ANDAvailability >...
November 6, 2015 at 9:30 am
To help the performance of your procs, you need to make sure no implicit conversions occur on table columns that are being compared against (WHERE column_name ...) or JOINed (INNER...
November 5, 2015 at 2:42 pm
Just as an FYI, you can use a CROSS APPLY in these types of situations to assign meaningful alias names to intermediate values, which can sometimes make the SELECT logic...
November 5, 2015 at 2:37 pm
IF that's a highly selective condition -- i.e., there are not many rows where that column has between 4 and 10 bytes -- then you might gain performance by adding...
November 5, 2015 at 2:10 pm
I would certainly rebuild that table, if it's used a lot or you have some other cause of concern over it. As always for best performance, first determine and...
November 5, 2015 at 10:14 am
To tune for performance, you first need to review missing index stats and index usage stats (and index operational stats, if you can). The main improvement is to determine...
November 5, 2015 at 10:12 am
What you're doing is very dangerous code inside a trigger, as it's likely to run quite a while.
That said, you can only reference the "inserted" from within the trigger itself,...
November 4, 2015 at 5:46 pm
Is this homework or similar? If so, we can only give you general guidelines, not fully completed SQL.
November 4, 2015 at 5:34 pm
river1 (11/4/2015)
Hi,
I saw this job below which runs from 20 to 20 minutos on my production server.
Is it normal to have a statistics update every 20 minutos?
...
and ...
November 4, 2015 at 5:22 pm
Viewing 15 posts - 4,651 through 4,665 (of 7,597 total)