Viewing 15 posts - 31 through 45 (of 7,597 total)
that lookup went into one of many nested loop join objects in the plan
(Nested) loop joins are a concern, particularly if SQL doesn't properly estimate the number of...
January 8, 2025 at 7:32 pm
If you select the query code, right-click on it, and then select "Display Estimated Execution Plan", you should see any recommended index
January 7, 2025 at 8:49 pm
SELECT B.*, CASE WHEN A.ServerName IS NULL THEN 'Not present in Table A'
ELSE 'Present in Table A' END AS Comment
FROM TableB B
LEFT...
January 3, 2025 at 8:07 pm
ALTER procedure db.ToolReduceLogFileSize
@db_name nvarchar(128),
@size_mb int = 1024
AS
SET NOCOUNT ON;
DECLARE @sql nvarchar(max);
SET @sql = 'USE [' + @db_name + '];...
January 2, 2025 at 9:06 pm
More technically, you need permissions for whatever account SQL Server is running under.
January 2, 2025 at 6:42 pm
... How does the @SINGLE_RETURN cause the messages to accumulate? ...
Steve
It doesn't. It's the "+=" that causes the msgs to "accumulate" (concatenate).
For example, if you do this:
DECLARE @msg varchar(max);
DECLARE...
January 1, 2025 at 11:16 pm
You can check for NULL as well in either format:
DECLARE @LATEST_DATE date;
SELECT @LATEST_DATE = ISNULL(MAX(MY_DATE), ...) FROM DBO.TABLE
December 27, 2024 at 3:06 pm
I think you'll have to check for that yourself, maybe something like this:
SELECT CASE WHEN TRY_CONVERT(DECIMAL(9,6),'6.125') <> TRY_CONVERT(DECIMAL(5,2),'6.125') THEN 'Loss of precision error' ELSE 'Good' END
SELECT CASE...
December 26, 2024 at 10:29 pm
Either below; the first is more typical:
DECLARE @LATEST_DATE DATE;
SELECT @LATEST_DATE = MAX(MY_DATE) FROM DBO.TABLE
--or:
SET @LATEST_DATE = (SELECT MAX(MY_DATE) FROM DBO.TABLE);
December 25, 2024 at 7:36 pm
It depends. If the unused space is significant and is embedded in pages that are being read, i.e. contain live data, then it could slow down access (somewhat) because more...
December 23, 2024 at 7:17 pm
(1) If you have a lot of dbs, make the $IDENTITY column a primary key in the table, so you have a seek instead of a scan
(2) DBCC CHECKDB can...
December 21, 2024 at 8:09 am
And, that is the correct method for moving dbs to a new drive.
December 17, 2024 at 7:34 pm
IF you're on SQL 2022, you can add "IGNORE NULLS" to the LAG function.
Otherwise you can use an OUTER APPLY with a SELECT TOP (1). For example:
SELECT...
December 16, 2024 at 3:31 pm
First, you need to correct the query to use the alias in the UPDATE, not the original table name. Other things to consider if still having problems:
(1) How large is...
December 11, 2024 at 6:51 pm
AFTER UPDATE is the more current syntax, so I would go with that.
I would also (1) take advantage of the UPDATE() function and (2) allow the trigger to properly set...
December 9, 2024 at 3:42 pm
Viewing 15 posts - 31 through 45 (of 7,597 total)