Viewing 15 posts - 5,551 through 5,565 (of 7,613 total)
Not sure. I suggest running both queries and then looking at the plan cache:
SELECT ecp.usecounts, ecp.cacheobjtype, ecp.objtype, est.text
FROM sys.dm_exec_cached_plans ecp
CROSS APPLY sys.dm_exec_sql_text(plan_handle) est
WHERE est.text LIKE '%field_enum_values%'
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 18, 2014 at 3:18 pm
PiMané (12/18/2014)
You can have the pk on the uniqueid and have a fillfactor of 70 or...
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 18, 2014 at 9:48 am
You can do the full db backup ahead of time. You can do a differential just before you do the index changes.
Script out all existing non-clustered indexes ahead 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".
December 17, 2014 at 3:47 pm
Here's a possible re-write of the first temp table INSERT:
insert into #temp_violation
select
tv.OrderID
,tv.StartDate
,tv.EndDate
,ca1.HourID
from EMSTBLSN.dbo.TimeViolation tv
cross apply (
select distinct fh.HourID
from G4SFEP1.dbo.Service fs
...
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 17, 2014 at 10:00 am
SELECT name
FROM table_name
UNION ALL
SELECT DISTINCT LEFT(name, 1) AS letter
FROM table_name
ORDER BY name
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 17, 2014 at 9:32 am
First thing is to get the best clustering:
Cluster the violation table on ( OrderID, StartDate )
Cluster the sanction table on ( OrderID, IdentifiedDate )
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 17, 2014 at 9:26 am
Might as well handle any db and any schema, but defaulting to your main one.
CREATE PROC CLEAR_MY_TABLE
@TableStat varchar(100)
AS
SET NOCOUNT ON;
DECLARE @TableStat varchar(100)
SET @TableStat = ISNULL(PARSENAME(@TableStat, 3),...
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 16, 2014 at 4:41 pm
Truncating tables is a great idea when applicable. It's vastly less logging overhead than deleting all the rows instead. Dropping the table and recreating is also more overhead...
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 16, 2014 at 4:31 pm
This query will find logins with a default db that is not online, and show any job(s) that login owns.
select sp.*, j.*
from sys.server_principals sp
left outer join msdb.dbo.sysjobs j 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".
December 16, 2014 at 4:27 pm
It's only 20 chars, I'd do it as simply as possible rather than over-complicate it:
SELECT MP.RefNum, MP.Phone,
CASE WHEN SUBSTRING(MP.Phone, 01, 1) LIKE '[0-9]' THEN SUBSTRING(MP.Phone,...
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 16, 2014 at 3:52 pm
If you just want to do INSERTs to the other table, and not UPDATEs:
CREATE TRIGGER trigger_name
ON dbo.CARTOES
AFTER INSERT, UPDATE
AS
SET NOCOUNT ON;
INSERT INTO dbo.another_table --(column_name1, column_name2, ...)
SELECT
[COD_ID],
[CODCTB],
[NIFCTB],
[NOMECTB],
[DT_EMISSAO],
[DT_VALIDADE],
[DT_ANULACAO],
[DESCR_REP_FISCAL],
[NUMCARTAO],
[STATUS],
[UTILIZADOR]
FROM inserted
GO
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 16, 2014 at 3:39 pm
PiMané (12/16/2014)
ScottPletcher (12/16/2014)
Is there any easy way to determine what FKs are "hanging" on the PK?
Yes, using view "sys.foreign_keys", and, if needed, "sys.foreign_key_columns" as well.
that's what i'm currently doing...
select the...
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 16, 2014 at 10:47 am
Yes, you need separate physical drives.
Smaller, cheaper drives very often work better than a single, more expensive drive. For I/O, the number of spindles is more critical than the...
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 16, 2014 at 10:33 am
Yes, UNION in "A", "B", "C", ..., "Z" to the source table and then sort it, something like this:
SELECT name
FROM table_name
UNION ALL
SELECT v.letter
FROM (VALUES('A'),('B'),('C')) AS v(letter)
ORDER BY name
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 16, 2014 at 10:31 am
Is there any easy way to determine what FKs are "hanging" on the PK?
Yes, using view "sys.foreign_keys", and, if needed, "sys.foreign_key_columns" as well.
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 16, 2014 at 10:26 am
Viewing 15 posts - 5,551 through 5,565 (of 7,613 total)