Viewing 15 posts - 1,066 through 1,080 (of 7,619 total)
CONCAT is not a safe way to do this because different values could appear to be the same.
Do all the columns have to match? Or just some?
For now,...
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 12, 2022 at 4:09 pm
You shouldn't use 'n/a' as a "value" in place of NULL. Effectively you're corrupting the data. You should just use NULL itself instead.
If all readers of the 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".
January 12, 2022 at 4:06 pm
That is not advisable as this will always start the job, even when it is disabled !
My point is: When a sysadmin or "sqlagent job manager" disables a job...
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 10, 2022 at 3:37 pm
I'm almost certain there's a more efficient way to do this, but I can't think of it now.
;WITH cte_valid_first_dose AS (
SELECT *
...
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 7, 2022 at 11:42 pm
SELECT
US.UID,
CASE WHEN COUNT(UD.UID) > 0 THEN 'YES' ELSE 'NO' END AS [UID Loaded],
CASE...
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 6, 2022 at 11:15 pm
You can start the job easily from the trigger using:
EXEC msdb.dbo.sp_start_job @job_name = '<your_job_name_here>'
That will just start the job and immediately return to the trigger (that is, I'm confirming 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".
January 6, 2022 at 4:26 pm
So just to clarify. if i have a clustered index on say contactid and invoiceid however none of the updates are on those columns then there wouldn't be 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".
January 5, 2022 at 10:38 pm
Are you on the latest CU? If you are behind any maintenance patch, I'd put that on first before doing other work.
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 5, 2022 at 5:24 pm
SELECT SUBSTRING(TableName, CHARINDEX('dbo.', TableName), 8000) AS TableName
FROM dbo.whatever
WHERE TableName LIKE '%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".
January 5, 2022 at 5:23 pm
WARNING: make sure that no more than, say, 3500 tables or so are processed by this script. The script is fairly complex and having way too many tables present (particularly...
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 5, 2022 at 5:20 pm
If you just want table names that start with 'dbo.', then you can do this:
SELECT STUFF(Tablename, 1, 4, '') AS Tablename
FROM dbo.ListOfTables
WHERE Tablename LIKE 'dbo.%' /*allows an...
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 5, 2022 at 4:43 pm
You can't ever look at missing index stats in isolation. You also need to look at existing indexes and their usage stats (and often I/O counts as well).
First, before doing...
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 5, 2022 at 4:39 pm
Thanks for the answer,
We already have views on top of our tables, so it would be easy to do. But that would serve no purpose. The main goal would...
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 5, 2022 at 2:31 pm
Going from 28 to 19 would reduce the storage required, so, as you've discovered, I think SQL would create a new column and copy the data over to 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 5, 2022 at 12:09 am
SELECT ca1.*
FROM dbo.Table1 t1
CROSS APPLY (
SELECT EmpNo, EmpName, DeptName, Location
UNION ALL
SELECT EmpNo, EmpName, DeptName, Location
...
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, 2022 at 4:00 pm
Viewing 15 posts - 1,066 through 1,080 (of 7,619 total)