Viewing 15 posts - 3,301 through 3,315 (of 7,613 total)
We could give a more specific answer if you'd show the actual code.
But, for example, if it's something like this:
WHERE ISNULL(date_column, '19000101') >= '20170101'
then you don'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".
July 2, 2018 at 2:58 pm
INSERT INTO dbo.Tbl3 ( ID1, ID2 )
SELECT (SELECT ID1 FROM dbo.Tbl1 WHERE Name1 = @Name1),
(SELECT ID2 FROM dbo.Tbl2 WHERE Name2 = @Name2)
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 2, 2018 at 1:51 pm
SELECT Total_Input, Total_OK, Total_Fail,
CASE WHEN Total_Fail > 0 AND Total_Fail > Total_OK THEN Total_OK
WHEN Total_Fail > 0 THEN Total_Fail
...
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 2, 2018 at 1:42 pm
SELECT b.time * 1.0 credit, 0.0 credits, b.Id, b.date
FROM staff b
INNER JOIN (
SELECT *, isnull(dbo.ConvDate2(e.Startdate),'20111101') AS Startdate_converted
FROM emp
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 2, 2018 at 9:18 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".
June 27, 2018 at 3:51 pm
I would hope that SQL itself would change it to an INNER JOIN when applicable, but it certainly won't hurt to try -- or verify using the query plan 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".
June 27, 2018 at 3:31 pm
aftab97 - Wednesday, June 27, 2018 1:39 PMThat's an idea, but the tables are vendor proprietary tables and can't be modified.
Does 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".
June 27, 2018 at 2:04 pm
Check to see if the db A on each instance allows cross-database ownership chaining:
SELECT is_db_chaining_on, *
FROM sys.databases
WHERE name IN ('A')
If it's 1, then security...
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".
June 27, 2018 at 9:52 am
We would have to see the tables definition and the query itself to give you a reliable answer here.
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".
June 27, 2018 at 9:46 am
While researching, I read online that unless you are using WITH(TABLOCK) when inserting...
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".
June 26, 2018 at 12:35 pm
Yes, eventually it will get compressed automatically. Although SQL doesn't actually do any page compression until the page gets full.
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".
June 26, 2018 at 10:47 am
Just plain DATEDIFF(DAY, ...) will do that. By definition, DATEDIFF counts the number of times the midnight boundary is reached/crossed between two dates/datetimes.
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".
June 26, 2018 at 10:45 am
DECLARE @CurrentYearStart INT
DECLARE @CurrentYearEnd INT
SET @CurrentYearStart = 201801
SET @CurrentYearEnd = 201805
SELECT *
FROM @test-2 t_curr
INNER JOIN @test-2 t_prev
...
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".
June 21, 2018 at 3:25 pm
To fix the immediate problem, try running:
DBCC CHECKIDENT ('dbo.CmEvent', RESEED, 55845910)
Better yet, rid yourself of the foolish and damaging myth that all tables should be clustered...
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".
June 21, 2018 at 10:12 am
select top 2 *
from (
select max(u.iduser) iduser, max(u.score)...
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".
June 20, 2018 at 9:31 am
Viewing 15 posts - 3,301 through 3,315 (of 7,613 total)