Viewing 15 posts - 2,566 through 2,580 (of 7,609 total)
If it's not Azure, i.e. you have access to the master db, create a proc in the master db and you can use it from any db and it will...
December 19, 2019 at 3:29 pm
You don't have a FROM clause in the subquery, so it's not really a valid subquery, even if the "Z" alias is defined somewhere else in the query.
You'd be better...
December 18, 2019 at 7:32 pm
declare @minutes_interval int
set @minutes_interval = 15 /*or 10 or 60 or whatever*/
select
dateadd(minute, datediff(minute, 0, starttime) / @minutes_interval * @minutes_interval, 0),
...
December 18, 2019 at 3:43 pm
Based on the extremely limited info so far, I would say this is likely the (very) rare case where you should leave the main table as a heap and create...
December 17, 2019 at 8:36 pm
Datetimes are char data when inputting to SQL Server. As long as the value is valid, don't specify your own CAST or CONVERT, let SQL do it implicitly.
If you have...
December 16, 2019 at 8:59 pm
Several. In our normal course of business, we do periodic restores, and I request periodic restores just to make sure they're working correctly. This particular company has done extremely well...
December 16, 2019 at 5:45 pm
I gotta say, my life's been so much easier since we out-sourced the backup part of my DBA job. I just define the backup rules, and someone else insures the...
December 16, 2019 at 3:48 pm
Here it is.
DECLARE @end_date date
DECLARE @semester_name nvarchar(10)
DECLARE @sql nvarchar(max)
DECLARE @sql2 nvarchar(max)
DECLARE @start_date date
SET @semester_name = 'Winter'
SELECT TOP (1) @start_date = begDtg, @end_date = endDtg
FROM dbo.trainingSemester
WHERE semesterName =...
December 13, 2019 at 7:46 pm
SELECT OrderId
FROM OrderItems
GROUP BY OrderId
HAVING SUM(CASE WHEN Status = 'Shipped' THEN 1 ELSE 0 END) < COUNT(*)
December 13, 2019 at 5:17 pm
If you're also looking into overall performance, don't neglect to specify both BUFFERCOUNT and MAXTRANSFERSIZE.
Yup - I did that in a few cases where squeezing any amount of...
December 12, 2019 at 6:05 pm
Issue an ALTER SEQUENCE statement with the change(s) you want to make.
December 12, 2019 at 6:04 pm
If you're also looking into overall performance, don't neglect to specify both BUFFERCOUNT and MAXTRANSFERSIZE.
December 12, 2019 at 3:30 pm
Most likely you've hit the "tipping point" for a table(s), where instead of using an index SQL reverts to a full table scan.
Rather than the full db size, we need...
December 12, 2019 at 3:06 pm
I think it's worth a second here to go through why a SQL NOT IN with a NULL value in it causes no values to match.
SQL Rule 1) A WHERE...
December 11, 2019 at 8:03 pm
Look at the history in msdb. If it's lengthy, clean some of it out. You would think SQL would use master to get the dbs in SSMS, but it also...
December 11, 2019 at 3:49 pm
Viewing 15 posts - 2,566 through 2,580 (of 7,609 total)