Viewing 15 posts - 4,696 through 4,710 (of 7,613 total)
The MIN and MAX need to operate on the dates in the table, not on GETDATE(), therefore more like this:
SELECT LoanID As [Loan ID]
FROM APayments
Where DraftDate > DATEADD(DAY, DATEDIFF(DAY, 0,...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 26, 2015 at 4:13 pm
I'd suggest not disabling a trigger unless it's absolutely necessary, and it almost never is.
You can instead use CONTEXT_INFO() to pass a flag to the trigger to "tell" it whether...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 26, 2015 at 4:08 pm
In the future, actual SQL statements to create the tables and insert rows would be required. But, for this request, the code should do what you're trying to do,...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 26, 2015 at 3:55 pm
SELECT rtmi.ItemID
FROM tbl_RF_Tags_Map_Items rtmi
WHERE rtmi.TagID IN (1, 8, 62)
GROUP BY rtmi.ItemID
HAVING MAX(CASE WHEN rtmi.TagID = 1 THEN 1 ELSE 0 END) = 1 AND
MAX(CASE WHEN rtmi.TagID...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 26, 2015 at 3:50 pm
Also look at sys.sql_expression_dependencies (or, if SQL 2005 only, at sys.sql_dependencies). Naturally that view is only for non-dynamic SQL references.
Or just right-click on the table name in SSMS and...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 26, 2015 at 3:45 pm
In general, you can use an approach like below to efficiently determine if specific, multiple tags match for the same item. Naturally we'd need more details to get any...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 26, 2015 at 3:04 pm
So I guess the tblCall table has only one row? Otherwise @Call_Date could be set to any row value from that table. That would make it almost impossible...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 23, 2015 at 2:41 pm
You need to be aware that recursion will be much, much slower, and much, much more CPU and memory overhead, than a tally table.
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 23, 2015 at 10:20 am
You must cluster the table properly to get good performance from large tables. You can instead try creating gazillions of covering indexes, to cover each (major) query, but...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 23, 2015 at 9:44 am
Just to clarify, a database backup does not fully back up the log. It gets only the active portion of the log necessary to bring that full backup to...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 23, 2015 at 9:37 am
Assuming the login doing the table mod has authority to run sp_send_dbmail, it should work. If not, you might need to look at additional permissions or using EXECUTE AS...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 22, 2015 at 2:32 pm
SELECT UniqID
FROM #SampleData
GROUP BY UniqID
HAVING MIN(Code) = 'ABC' AND MAX(Code) = 'ABC'
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 22, 2015 at 2:24 pm
As additional background, SQL estimates the memory it will need to do the sort ahead of time, based on its estimated row count and row size. If you end...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 22, 2015 at 11:49 am
As has been noted, the tables are definitely wrongly clustered, and that is causing the bad performance. Because, as has also been noted, of the "junior error" of assuming...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 22, 2015 at 11:47 am
Or this:
SELECT
OBJECT_NAME(fkc.parent_object_id) AS [Referencing Table],
fkc.parent_object_id AS [Referencing Object ID],
OBJECT_NAME(fkc.referenced_object_id) AS [Referenced Table Name],
fkc.referenced_object_id...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
October 22, 2015 at 11:30 am
Viewing 15 posts - 4,696 through 4,710 (of 7,613 total)