Viewing 15 posts - 3,631 through 3,645 (of 7,619 total)
Here's one way:
SELECT CAST(DATEADD(HOUR, 11, OrderDate) AS date) AS Date,
COUNT(*) AS Count
FROM (VALUES
(908, '1/3/2018 13:20:34'),(
909, '1/3/2018 15:18:41'),(
910, '1/4/2018 09:15:21'),(
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 8, 2018 at 2:35 pm
SELECT {column_list, ...}
INTO #TEMP2 -- Max ZATS
from
(
Select
ZBF.[HTS_NUMBER]
,#TEMP1.Part_Num
,row_number() OVER (PARTITION BY Composite_part ORDER BY Insert_Date DESC) AS Max_Date
,Max ([TSI].[ZATS_BROKER_FEED].Insert_Date) 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".
January 8, 2018 at 11:37 am
Create views to do the joins. Yes, users shouldn't be expected to correctly write 5-column joins. And they never should -- they should use a view that does the join(s)...
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 8, 2018 at 9:50 am
, cast (convert(varchar(8), po.PolicyIssueDt, 112) as int) as PolicyIssueDt
, cast(convert(varchar(8),po.PolicyEfftvDt, 112) as int) as PolicyEfftvDt
, cast(convert(varchar(8), po.PolicyExpirDt, 112) as int) as PolicyExpirDt
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 8, 2018 at 9:47 am
You may or may not need to create another index for StoreNumber first. It's possible SQL would never use such an index even if you created it.
If you...
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 8, 2018 at 9:42 am
If you have FK relationships, you don't have to do the data changes yourself.
Script out the FKs, "DROP and CREATE", and change the "ON UPDATE CASCADE" to "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".
January 4, 2018 at 3:50 pm
I don't know about detach at this point, but with some "fancy footwork" you can DROP a database only if it was OFFLINE. You have to rollback the DROP, of...
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 4, 2018 at 2:37 pm
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".
December 29, 2017 at 8:25 am
Or perhaps multiply by 2.2046226218, or some shorter variant of that, if you need more accuracy. 2.2 is rather rough estimate.
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".
December 29, 2017 at 8:18 am
Maybe easy, maybe not. You have to create a synonym for every remote object you reference. And keep them in sync if, for any reason, you have to rename an object.
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".
December 27, 2017 at 10:20 am
That's going to be a royal pita.
Why not just stop using different names for dev and prod? It's easier to mess up the aliasing than it is 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".
December 26, 2017 at 2:41 pm
From Books Online, under sys.dm_db_index_operational_stats:
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".
December 26, 2017 at 9:11 am
Go by the values in the clustered index. For example, if the table is clustered on a datetime column, use that as the value for the UPDATE.
Here's a...
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".
December 22, 2017 at 8:27 am
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".
December 22, 2017 at 7:15 am
The key lookups should cost more than the sort for only 7 rows (I know the lookup is in both queries). You should consider adding DateRegistered to the NC lindex. 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".
December 21, 2017 at 3:11 pm
Viewing 15 posts - 3,631 through 3,645 (of 7,619 total)