Viewing 15 posts - 1 through 15 (of 19 total)
Small tip: you can always do PRINT/SELECT instead of EXEC of dynamically built query, then copy/paste it to SSMS and you'll see all syntax errors.
July 27, 2020 at 7:35 am
You'll always have single plan for single statement. Stored procedures can have several queries so there could be several plans. This is not the case with scalar functions.
Common practice is...
July 27, 2020 at 7:31 am
Steve, can the SQL Prompt colorize by user?
July 22, 2020 at 3:23 pm
It's not exactly what you ask, but Redgate SQL Prompt allows you to create color for tabs. I usually put RED to all environments where I need to be more...
July 22, 2020 at 2:04 pm
Not only OUTER APLLY is the problem, you can't use MAX function in the indexed view. Check "Additional Requirements"
July 15, 2020 at 11:48 am
I would not recommend using MERGE. First of all, how would you compare that there is diff? Join by all columns? Then what about nulls?
Moreover MERGE functionality is buggy... Please...
July 10, 2020 at 2:50 pm
Could you please provide more details as it is a bit unclear what do you mean. Please provide some data examples, what you are getting wrong and what exactly you...
July 10, 2020 at 7:19 am
So, as far as I understood you need to insert records into Table2 from Table1 that do not exist in Table2. Then you can use following approach:
INSERT...
July 10, 2020 at 7:14 am
Refresh statistics
July 9, 2020 at 7:16 am
Just small tip, if you add sample data then it is more useful for people helping you if you provide it by DDL and data inserts. In that case the...
July 8, 2020 at 12:45 pm
First of all, don't add SQL code as a picture, add it as a text. There is "{;} Insert/edit code sample" button to make the code highlighted properly.
According to your...
July 8, 2020 at 8:07 am
It's hard to optimize without having access to the database, but this is my try:
WITH exclusions
AS
(SELECT
[legalReference].[legalID] AS [Role_ID]
FROM [legalReference]
WHERE [legalReference].[legalType] = 1
AND [legalReference].[RoleID] = 20000
UNION ALL
SELECT
[Groups_Roles].[RoleID]
FROM [legalReference]
JOIN...
July 7, 2020 at 2:23 pm
I'm sorry, but this is Microsft SQL Server forum, not MySQL. These are completely different products.
July 7, 2020 at 11:39 am
When you compare it can return either true or false. If it is true, then the row is returned otherwise - not. "ColumnName" returns some numeric value expression does as...
July 7, 2020 at 5:54 am
Viewing 15 posts - 1 through 15 (of 19 total)