Viewing 15 posts - 4,036 through 4,050 (of 7,619 total)
I'd urge you not to create triggers on system tables, particularly job tables.
The sysjobs table does have a "date_modified" column. Presumably that column is updated whenever any step within that...
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".
November 28, 2016 at 1:59 pm
Hmm, not sure. That file name should be allowed.
Verify again that the filename is correct:
USE <your_db_name>
EXEC sp_helpfile
The first column of the output will contain the logical file names.
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".
November 28, 2016 at 1:48 pm
No, it isn't.
First, the first constraint name in the EXISTS is not the same as the first one in the code.
Second, you really need to check for, and create, these...
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".
November 28, 2016 at 1:46 pm
Something like this should do it:
SELECT
SUM(CASE WHEN YEAR(Invoice_date) = YEAR(curr_year_jan_01) - 2 THEN amount ELSE 0 END) AS Total_2_Years_Ago,
SUM(CASE WHEN YEAR(Invoice_date) =...
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".
November 28, 2016 at 1:41 pm
When a user wants to search for something in that log they almost always use a filter on the Created column. ...
* Clustured Index is a good choice when dealing...
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".
November 25, 2016 at 9:58 am
This should be more efficient:
SELECT VisitID
FROM #Test
GROUP BY VisitID
HAVING MAX(CASE WHEN IsPrimaryCareProvider ='Y' THEN 1 ELSE 0 END) = 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".
November 23, 2016 at 8:34 am
First, the Project table should be keyed on ( DomainID, SchoolID, ID ), if, as your example query implies, Domain is the more dominant "parent" relation. Reverse the first two...
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".
November 22, 2016 at 11:19 am
Something like this should do it:
IF OBJECT_ID('tempdb.dbo.#table2_data') IS NOT NULL
DROP TABLE #table2_data
--create the table structure for #table2_data
SELECT TOP (0)
Application,
...
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".
November 16, 2016 at 11:19 am
You have a couple of choices.
If you are willing to allow them to run any (local) job, you can add them to the SQLAgentOperatorRole in msdb.
If you want them 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".
November 14, 2016 at 11:54 am
Is this acceptable? No.
Can this be improved? Yes.
Most importantly, you do not need an identity column on two of these tables. Despite what some people may imply, there's no...
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".
November 10, 2016 at 10:39 am
The real solution is very likely to cluster the table on event_date, if that is how you most often query the table. You'll get minimum I/O without having 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".
November 8, 2016 at 1:43 pm
TheSQLGuru (11/8/2016)
ScottPletcher (11/8/2016)
It depends on how complex the trigger logic and how much different it is for each type of modification whether you want separate triggers or not.
I disagree on...
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".
November 8, 2016 at 1:29 pm
It depends on how complex the trigger logic and how much different it is for each type of modification whether you want separate triggers or not.
But you can definitely simplify...
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".
November 8, 2016 at 8:24 am
drew.allen (11/3/2016)
ScottPletcher (11/3/2016)
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".
November 3, 2016 at 3:55 pm
drew.allen (11/3/2016)
ScottPletcher (11/3/2016)
UPDATE table_name
SET Foo = CASE WHEN Foo > '' THEN ', ' ELSE '' 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".
November 3, 2016 at 3:53 pm
Viewing 15 posts - 4,036 through 4,050 (of 7,619 total)