Viewing 15 posts - 6,361 through 6,375 (of 7,613 total)
Be aware that a global temp table means the code must be single-threaded, as simultaneous executions of the code would stomp on each other.
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 30, 2013 at 1:45 pm
Here's my version to do only a single pass of the table.
But I'm not sure why you want to list only "D" in the result, since both "B" and "D"...
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 30, 2013 at 1:39 pm
Seems to me like it must be two different RAID5 sets ... wouldn't different drives on the same RAID set already be using both drives?!
Either way, I'd delay your #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".
September 27, 2013 at 3:22 pm
Neither CAST nor CASE is actually necessary here:
SIGN(CHARINDEX('@', <string_value>))
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 27, 2013 at 9:55 am
Btw, if weekdayid is unique (and it seems like it has to be for this table to make sense), get rid of the dopey IDENTITY column in this 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".
September 27, 2013 at 9:50 am
... will select count(*) get the keep changed record numbers even if (nolock) hint is on?
Actually, it will count uncommitted records if and only if (nolock) or the equivalent 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 27, 2013 at 9:47 am
I prefer CROSS APPLY(s) to CTE(s) for aliasing. For example:
Select TOP 5 ID ,MID, RName,Pic1,FoodType.Descr AS FoodType,Average_P_PP,lat,lng,
ca1.Distance
From Member WITH(NOLOCK)
INNER JOIN FoodType WITH(NOLOCK) 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".
September 27, 2013 at 9:43 am
Why mess with the DATEFIRST setting when it's not necessary? There are methods which can do the calculation simply without needing a specific datefirst setting, so why hassle with...
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 27, 2013 at 9:38 am
As another kludge, you could probably do this:
COALESCE(
CASE WHEN @MonthUnits = 1 THEN GBAN01 ELSE NULL END,
CASE WHEN @MonthUnits = 2 THEN GBAN02 ELSE...
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 19, 2013 at 3:42 pm
You can use a FULL OUTER JOIN to find columns that are in only one object and not the other.
I can post sample code for that if you'd like.
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 19, 2013 at 3:18 pm
You're on the right track; definitely use the sys. views rather than the INFORMATION_SCHEMA views, which are not reliable in SQL Server (from 2005 on).
These are the basic tables you'll...
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 19, 2013 at 3:15 pm
I've been a manager. I'm not sure immediately running to a higher-level authority reflects well on you.
Avoid the drama if at all possible. Speak privately and directly with...
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 18, 2013 at 12:38 pm
Or this:
SELECT SUBSTRING(@MyValue, CHARINDEX('<EntryID>', @MyValue) + 9, CHARINDEX('</EntryID>', @MyValue) - CHARINDEX('<EntryID>', @MyValue) - 9)
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 18, 2013 at 9:22 am
UPDATE dbo.tablename
SET col = LEFT(col, CHARINDEX('.', col) + 2)
WHERE col LIKE '%.___%'
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 17, 2013 at 10:39 am
INSERT INTO #tmpJDEnbrunits
SELECT
'000' + ltrim(MCMCU),
CASE @MonthUnits WHEN 1 THEN GBAN01 WHEN 2 THEN GBAN02 WHEN 3 THEN GBAN03 --...
...
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 17, 2013 at 10:35 am
Viewing 15 posts - 6,361 through 6,375 (of 7,613 total)