Viewing 15 posts - 1,336 through 1,350 (of 7,619 total)
It's still a falsehood. The docs say it is the "false_value", but the result is not "false". ELSE is accurate, because that simply means the WHEN condition was...
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".
August 18, 2021 at 5:17 pm
I assume you replace any functions where CASE can be used - or is it only IIF that you don't use?
Like a COALESCE with 10 arguments,...
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".
August 18, 2021 at 4:05 pm
The rule for SQL expressions and functions is that if a NULL value goes in, a NULL value comes back, unless you explicitly do something to change that.
IIF violates, in...
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".
August 18, 2021 at 3:55 pm
I assume you replace any functions where CASE can be used - or is it only IIF that you don't use?
Like a COALESCE with 10 arguments, for example....
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".
August 18, 2021 at 3:38 pm
CLR functions for performing Regular Expression searches aren't SQL either, but they're useful. Where do you draw the line?
IIF is part of T-SQL and is more succinct...
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".
August 18, 2021 at 3:36 pm
You should just be able to add this to the end of your existing calc:
(DATEDIFF...
- (SELECT COUNT(*) FROM dbo.Holidays H WHERE H.date BETWEEN JobStartDate AND JobEndDate)
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".
August 18, 2021 at 3:15 pm
CLR functions for performing Regular Expression searches aren't SQL either, but they're useful. Where do you draw the line?
IIF is part of T-SQL and is more succinct than CASE,...
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".
August 18, 2021 at 3:07 pm
I don't see the need for all that, this is much simpler:
SET @ytdfrDate = DATEFROMPARTS(YEAR(@frdate) -
CASE WHEN MONTH(@frdate) < 4...
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".
August 18, 2021 at 12:54 pm
Invoice line items can have a ship date
Only with a bad data model. Parts from the same invoice line could be shipped on different dates. You don't split...
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".
August 18, 2021 at 5:03 am
I don't see the need for all that, this is much simpler:
SET @ytdfrDate = DATEFROMPARTS(YEAR(@frdate) -
CASE WHEN MONTH(@frdate) < 4 THEN 1...
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".
August 18, 2021 at 4:59 am
Bruin wrote:With the same Line,subline?
Look at the PK you've chosen. IMHO, only the first 3 columns of InvoiceNbr, Line, and SubLine should make up the PK.
I'm more confused than...
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".
August 18, 2021 at 4:49 am
CONVERT works on a single value at a time. Thus, the query should be more like:
and a.myDate BETWEEN CONVERT(date, '20201108') AND CONVERT(date, '20201116')
The strings will have to be converted 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".
August 18, 2021 at 4:41 am
Either one can do the install. The DBA will need to provide some settings for the Windows team, but that team should be able to do an install as well.
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".
August 17, 2021 at 3:50 pm
No.
If it's doing a lookup only (not modifying data, just reading it), you could also use WITH (NOLOCK) on the table to reduce overhead of the lookups. I would argue...
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".
August 17, 2021 at 1:53 am
View sys.change_tracking_databases returns the db names of all dbs that have change tracking enabled.
Thus, the db name will not be in the view if change tracking is off.
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".
August 17, 2021 at 1:51 am
Viewing 15 posts - 1,336 through 1,350 (of 7,619 total)