Viewing 15 posts - 7,171 through 7,185 (of 7,619 total)
SQL Server is optimized to do table lookups, whereas CASE statements are comparatively very slow.
Therefore, I suggest using a lookup table, as suggested by others. You absolutely want 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 2, 2012 at 4:11 pm
#days / 7 = #wks
#days % 7 = #days
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 2, 2012 at 4:04 pm
I wouldn't duplicate l lot of columns for a covering index w/o real research showing it was 100% necessary.
You should consider the possibility of clusterting tableB on fk_id, but 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".
October 2, 2012 at 4:00 pm
Eugene Elutin (10/2/2012)
[
...
Is this statement true? If so is it better to use Guid or BIGINT?
It depends, but usually BIGINT is better.
Another question, related to keys... If a table uses...
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 2, 2012 at 3:51 pm
Ellen-477471 (10/2/2012)
I've searched for this...
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 2, 2012 at 9:38 am
If you typically query the Document table by PersonId, change the clustered key on the Document table to be PersonId instead and you should get great response time for individuals...
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".
September 28, 2012 at 1:44 pm
And for general performance reasons, get rid of the functions on the date/datetime column:
SELECT p.product,
SUM(CASE WHEN j.holiday = 0 THEN j.qty_delivered END) 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".
September 28, 2012 at 1:36 pm
You could try:
SELECT SERVERPROPERTY('ComputerNamePhysicalNetBIOS')
If that doesn't work, there are SERVERPROPERTY parameters that aren't documented: you might try poking around for some of those and see if any of them help...
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".
September 28, 2012 at 1:24 pm
Try:
ADD (SELECT ON OBJECT::[dbo].[SecDetail] BY [dbo])
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".
September 28, 2012 at 1:20 pm
S_Kumar_S (9/24/2012)
I logically expect NULL records to be returned here, but they are not. ... Is there some setting which impacts this behavior?
Yes there is a setting, but you should...
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".
September 25, 2012 at 10:44 am
Jeff Moden (9/24/2012)
It would take a little more space but I recommend adding the PERSISTED hint.
For me, it depends, mostly on how and/or how often the full_name was used.
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".
September 24, 2012 at 5:17 pm
Agreed.
For example:
ALTER TABLE dbo.tablename
DROP COLUMN Full_Name;
ALTER TABLE dbo.tablename
ADD Full_Name AS CAST(ISNULL(F_Name + ' ', '') + ISNULL(Lname, '') AS varchar(100))
-- change 100 to whatever max length you want for...
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".
September 24, 2012 at 9:11 am
Jeff Moden (9/20/2012)
SomewhereSomehow (9/20/2012)
That a person is in wikipedia means that he is notorious enough that someone thought to write of him.
It is also possible that person wrote about themselves...
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".
September 20, 2012 at 4:28 pm
SomewhereSomehow (9/20/2012)
Evil Kraig F (9/20/2012)
Perhaps, I've been accused of optimism before... rarely, but it's happened. I'm sorry to hear your political system is falling apart however.
Actually it is...
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".
September 20, 2012 at 4:11 pm
GSquared (9/20/2012)
SomewhereSomehow (9/20/2012)
Nope. Not going to taint you with my personal opinions regard Mr. Celko. Too bad he is a co-author with Itzik on a book as I...
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".
September 20, 2012 at 2:21 pm
Viewing 15 posts - 7,171 through 7,185 (of 7,619 total)