Viewing 15 posts - 2,566 through 2,580 (of 7,614 total)
Great article, very interesting and thought provoking.
Thanks again for taking the time to post this.
December 24, 2019 at 3:38 pm
To give the best chance of using minimal logging, be sure to lock the table that is being INSERTed into:
...
INSERT INTO dbo.B WITH (TABLOCK)
...
December 24, 2019 at 3:34 pm
That's an extraordinarily complex task when you really look into the more difficult cases, with honorifics (Dr., etc.), suffixes (III, IV) and so on.
I would do this process one time,...
December 23, 2019 at 11:03 pm
Or this:
SELECT lastName, LEFT(lastName, 5) AS lName FROM myTable
December 23, 2019 at 7:57 pm
SELECT SUM(Expenses) AS Expense, Vendor, MAX(UploadDate) AS UploadDate
FROM dbo.a_table
GROUP BY Vendor
December 19, 2019 at 7:30 pm
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
Viewing 15 posts - 2,566 through 2,580 (of 7,614 total)