Viewing 15 posts - 4,426 through 4,440 (of 7,613 total)
Yes.
The first query only considers rows where [LotJob] = '0000337495'.
The second first gets the max LotJob and then that max value must be = '0000337495' for the row...
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".
February 17, 2016 at 9:31 am
Hugo Kornelis (2/16/2016)
ScottPletcher (2/16/2016)
Get rid of the dashes (-) in the date, they introduce errors (ambiguity).Use format 'YYYYMMDD [hh:mm:ss]', which is always interpreted correctly, regardless of language/date settings.
Sorry, 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".
February 16, 2016 at 1:26 pm
Sounds like a good way to get yet more of the dreaded:
String or binary data would be truncated.
error. MS, seriously, you can't tell us which column had the error??...
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".
February 16, 2016 at 1:18 pm
These are unlikely, but let's:
1) add brackets around the db name, just in case.
2) specify a 'dbo' schema for the table name, just in case. It's easy to accidentally...
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".
February 16, 2016 at 1:13 pm
Get rid of the dashes (-) in the date, they introduce errors (ambiguity).
Use format 'YYYYMMDD [hh:mm:ss]', which is always interpreted correctly, regardless of language/date settings.
declare @CLUSTER_CODE as nvarchar(3)
declare@START_MONTH as nvarchar(2)
declare@START_YEAR...
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".
February 16, 2016 at 12:58 pm
For statistics, I'd do what DTA said. For indexes, definitely not, all DTA index recommendations should be thoroughly reviewed before creating/implementing. But for stats, if SQL "says" it...
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".
February 16, 2016 at 12:48 pm
Sorry, don't have much time but here's a quick overview of one method to consider:
1) create another table with the new bigint data type to copy the existing data 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".
February 12, 2016 at 1:24 pm
I would think sys.sql_expression_dependencies would contain those references, since a table-type is in sys.objects, type = 'tt'.
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".
February 12, 2016 at 12:58 pm
ALTER TRIGGER [dbo].[BadUpdate]
ON [dbo].[SomeTable]
INSTEAD OF UPDATE
AS
SET NOCOUNT ON
IF EXISTS (
SELECT 1
FROM dbo.Foo
...
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".
February 11, 2016 at 2:28 pm
Rather than being "stuck" on tuning, why not take this as an opportunity to possibly tune the query overall and post the code? Perhaps it can be reduced below...
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".
February 10, 2016 at 9:42 am
If you create a new column, and copy existing data to that column, you don't have to UPDATE every row in a single transaction. And you don't have 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".
February 10, 2016 at 7:43 am
So the entire 460GB is in the main part of the table, none in overflow space? Often with a row that wide you'd be able to offload a decent...
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".
February 9, 2016 at 3:38 pm
Yeah, should be good, except that I'd use varchar instead of char so that you don't have trailing spaces after the /s are replaced.
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".
February 9, 2016 at 3:30 pm
Sergiy (2/9/2016)
ScottPletcher (2/9/2016)
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".
February 9, 2016 at 2:23 pm
That sounds like Oracle not SQL Server. SS doesn't have CTAS syntax.
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".
February 9, 2016 at 12:32 pm
Viewing 15 posts - 4,426 through 4,440 (of 7,613 total)