Viewing 15 posts - 5,191 through 5,205 (of 7,614 total)
The on-going maintenance is higher for an INSTEAD OF trigger, since every column addition or deletion, and some column changes, all requires changes the trigger, which is not the case...
April 17, 2015 at 6:48 am
CREATE TRIGGER MYTABLE_AUDIT__TRG_INSERT_UPDATE
ON dbo.MYTABLE_AUDIT
AFTER INSERT, UPDATE
AS
SET NOCOUNT ON;
UPDATE ma
SET ma.DateModified = GETDATE()
FROM MYTABLE_AUDIT ma
INNER JOIN inserted i ON
i.AID = ma.AID
WHERE
i.DateModified IS NULL;
GO...
April 16, 2015 at 2:36 pm
Use an AFTER trigger(s) for both INSERT and UPDATE.
April 16, 2015 at 1:47 pm
For example:
--USE [<your_db_name_here>] --naturally make sure you are in the right db
SET DEADLOCK_PRIORITY LOW --probably irrelevant, but just in case
DECLARE @list_missing_indexes bit
DECLARE @table_name_pattern sysname
--NOTE: showing missing indexes can take some...
April 16, 2015 at 1:08 pm
You will need to look at least at the stats SQL provides for indexes:
1) missing index stats and
2) index usage stats.
Between those and you knowledge of the table, we...
April 16, 2015 at 1:07 pm
Lowell (4/16/2015)
Talib123 (4/16/2015)
They believe it will improve...
April 16, 2015 at 11:04 am
Someone's apparently discovered an obscure bug that's being repeated here. Software bugs are just bugs, we can't "explain" them.
April 16, 2015 at 10:05 am
There are many, many times when the PK should not be the clustered index. Why do you think it should be changed??
April 16, 2015 at 9:10 am
You're welcome. The really great thing is that that code still works perfectly if/when you convert the column itself to datetime (or date) ... nice!
April 16, 2015 at 8:18 am
You want to use the current index where possible, so do this:
select MRN, Name, AppointmentDate
from DATA
where datetime >= '2015-04-01 00:00:00.000'
and datetime < '2015-05-01 00:00:00.000'
April 15, 2015 at 2:14 pm
Detach now (since SQL 2005, IIRC) changes the security on the files -- this is an intentional thing by MS, as a "security feature". But it's been a royal...
April 15, 2015 at 2:11 pm
You check for a "GLOBAL" cursor but you don't explicitly specify a GLOBAL cursor when you DECLARE it. Whether a cursor is local or global can vary based on...
April 15, 2015 at 2:07 pm
You should look into RCSI as well. That may solve your issue even more completely and with less effort during coding :-).
April 14, 2015 at 3:11 pm
CREATE FUNCTION [dbo].[CheckLoginDetails_Username] (
@SuppliedUsername nvarchar(150),
@SuppliedPassword nvarchar(150)
)
RETURNS bit
AS
BEGIN
RETURN (
SELECT CASE
...
April 14, 2015 at 1:00 pm
Maybe a join to reduce repetition of comparisons:
SELECT bf.BF_ORGN_CD, bf.BF_BDOB_CD, bf.BF_TM_PERD_CD, bf.data
FROM BF_DATA bf
INNER JOIN (
VALUES('A1', 'B1', 'C1'),
...
April 14, 2015 at 9:56 am
Viewing 15 posts - 5,191 through 5,205 (of 7,614 total)