Viewing 15 posts - 2,746 through 2,760 (of 7,619 total)
Technically, if j.Grp is NULLable, I think you'd need to use:
WHERE j.Grp IS NOT NULL AND j.Code <> 'L3'
to insure the same results as the original code.
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 15, 2019 at 8:13 pm
You waste space and risk ambiguity by storing dashes in a date? Seriously? If for some bizarre reason one insists on storing dates as char, they should be YYYYMMDD. Unambiguous. ...
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 6, 2019 at 9:29 pm
I don't really have any issue with storing cc numbers as char(16), especially since they'll need to be encrypted and end up being stored as binary anyway. I also wouldn't...
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 6, 2019 at 6:35 pm
Actually an identifier is numeric (integer) because it just makes no common sense to do otherwise. Overly-pedantic concerns about whether it's used in math or not are actually irrelevant. There...
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 6, 2019 at 4:54 pm
Probably cleaner to check for 0 values as you INSERT the row:
INSERT INTo #a
select NULLIF(0,0),NULLIF(1,0),NULLIF(0,0),NULLIF(2,0)
union ALL
select NULLIF(0,0),NULLIF(2,0),NULLIF(0,0),NULLIF(3,0)
union ALL
select NULLIF(0,0),NULLIF(3,0),NULLIF(0,0),NULLIF(4,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".
August 6, 2019 at 1:57 pm
A trigger is actually perfect for this situation. For the email, it's probably best to add row(s) to a table or queue, then construct and send the emails based 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".
August 1, 2019 at 7:43 pm
It seems like it, but SQL 2008 doesn't directly read JSON, afaik. It might be easier to handle it with T-SQL rather than try to create some external function/process.
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 1, 2019 at 7:18 pm
yyyy-mm-00 is not an interval either. The interval would be yyyy-mm-01 to yyyy-mm-{EOM}.
yyyy-mm-00 sorta looks like a date, but it is not one, no matter how much fluff you put...
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 1, 2019 at 5:55 pm
Limited sample data, but I think this should perform better, since it avoids all the CHARINDEX costs:
SELECT A.ID, B.ItemNumber,
MAX(CASE WHEN D.Item...
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 1, 2019 at 5:39 pm
The disadvantage is that it violates 1NF big time. A "date" such as yyyy-mm-00 is not a date it is multiple dates. Thus, it violates 1NF.
Besides which, SQL Server does...
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".
July 31, 2019 at 8:49 pm
Agreed. Be nice if MS added the option to the CREATE TABLE statement, so that SQL would "know" that the variable length bytes are not needed at all for the...
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".
July 31, 2019 at 5:06 pm
I created a table with 433 columns: that's where I got the number from. I was hoping that 500 might be possible but the variable-length byte overhead still being required killed...
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".
July 31, 2019 at 3:25 pm
One key thing to note is that you only need to calc the first Sunday date. For future dates, you simply add 7 day intervals to that date. 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".
July 30, 2019 at 5:11 pm
Again, no method will allow you to have more than 433 nvarchar(max) values in one row. Just use separate rows. The entire design needs reworked to make it reasonable 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".
July 30, 2019 at 4:56 pm
Use an INSERT trigger to add the hashed column.
SET ANSI_NULLS ON;
SET QUOTED_IDENTIFIER ON;
GO
CREATE TRIGGER employee_table__TR_INS
ON dbo.employee_table
AFTER INSERT
AS
SET NOCOUNT ON;
UPDATE et
SET row_value = HASHBYTES('SHA2_256', first_name + last_name)
FROM dbo.employee_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".
July 30, 2019 at 4:54 pm
Viewing 15 posts - 2,746 through 2,760 (of 7,619 total)