Viewing 15 posts - 5,431 through 5,445 (of 7,613 total)
I'd stick with the AFTER trigger. Your initial trigger was pretty much spot on.
In case you create other AFTER triggers later, you might want to explicitly designate that trigger...
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".
January 27, 2015 at 9:57 am
Jeff Moden (1/26/2015)
ScottPletcher (1/26/2015)
dwain.c (1/25/2015)
coalesce(a.processStatus, 0) = 0
is not SARGable, so that could be improved on by making the processStatus column NOT NULL.
It's much better to code it as:
(a.processStatus...
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".
January 27, 2015 at 9:09 am
dwain.c (1/25/2015)
coalesce(a.processStatus, 0) = 0
is not SARGable, so that could be improved on by making the processStatus column NOT NULL.
It's much better to code it as:
(a.processStatus is null or...
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".
January 26, 2015 at 1:56 pm
g.britton (1/26/2015)
Jeff Moden (1/24/2015)
RonKyle (1/24/2015)
What are the issues with DATETIME2 and DATEDIFF?
Simple. Given a single row that contains StartDate and EndDate columns as DATETIME2 columns, write the code 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".
January 26, 2015 at 1:42 pm
TomThomson (1/23/2015)
ScottPletcher (1/23/2015)
TomThomson (1/23/2015)
Sean Lange (1/23/2015)
Eric M Russell (1/23/2015)
Date/Time: datetime, offset, varchar?There is only one option here. Datetime.
I suppose if your dBMS is anccient enough that's excusable. 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".
January 23, 2015 at 1:25 pm
TomThomson (1/23/2015)
Sean Lange (1/23/2015)
Eric M Russell (1/23/2015)
Date/Time: datetime, offset, varchar?There is only one option here. Datetime.
I suppose if your dBMS is anccient enough that's excusable. But it probably...
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".
January 23, 2015 at 12:50 pm
MMartin1 (1/23/2015)
EXEC SP_HELPTEXT 'schema.viewName';This formats the output across multiple lines rather than just one. I find it way handier when copying long definitions to the SSMS window.
True; it's easier 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".
January 23, 2015 at 11:43 am
I'm stunned Celko hasn't weighed in and told us how to name things properly rather than relying on punched cards and tape naming!
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".
January 23, 2015 at 9:44 am
Phil Parkin (1/23/2015)
ScottPletcher (1/23/2015)
Phil Parkin (1/23/2015)
Steve Jones - SSC Editor (1/23/2015)
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".
January 23, 2015 at 9:43 am
Phil Parkin (1/23/2015)
ScottPletcher (1/23/2015)
Phil Parkin (1/23/2015)
Steve Jones - SSC Editor (1/23/2015)
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".
January 23, 2015 at 9:32 am
I think it's just that some company -- probably Microsoft -- did it in some of their early tables and people copied it without reflecting on whether it needed changed...
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".
January 23, 2015 at 9:17 am
Phil Parkin (1/23/2015)
Steve Jones - SSC Editor (1/23/2015)
ProductId would look...
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".
January 23, 2015 at 9:08 am
I don't get why just "ID" is fully capitalized. Why not "addr"?
Why is it:
ProductID
but:
ProductAddr
rather than:
ProductADDR
Why selectively capitalize just one abbreviation? Why the inconsistency?
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".
January 23, 2015 at 8:33 am
I prefer product_id. Using mixed case is a real p.i.t.a. on a case-sensitive server!!
But, ProductId seems right to me if you're going to camel case.
For example, say you had...
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".
January 22, 2015 at 4:09 pm
You can use either:
function "fn_listextendedproperty"
or directly read view "sys.extended_properties"
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".
January 22, 2015 at 3:56 pm
Viewing 15 posts - 5,431 through 5,445 (of 7,613 total)