Viewing 15 posts - 766 through 780 (of 1,494 total)
SELECT SUM(1 & IND1) AS IND1
,SUM(1 & IND1 & IND2) AS IND2
,SUM(1 & IND1 & IND2 & IND3) AS IND3
-- etc
FROM ALL_INDS
February 23, 2011 at 10:11 am
There could be both inserts and updates:
SET ANSI_NULLS, QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER [dbo].[Update2ndTable]
ON [dbo].[Table1]
AFTER INSERT, UPDATE
AS
SET NOCOUNT ON
UPDATE T2
SET EmailAddr = I.EmailAddr
,Folder = RTRIM(UploadPath) + '\' + RTRIM(UserName)+ '\Downloads'
FROM [dbo].[Table2]...
February 23, 2011 at 9:26 am
Without some sample data and DDL it is difficult to say.
You need to do something to ensure that only a one to one relationship exists.
February 21, 2011 at 11:10 am
This is the problem when using UPDATE with a JOIN.
You have to ensure there is only a one to one relationship between the two tables. If there is a one...
February 21, 2011 at 10:56 am
SET ANSI_NULLS, QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER dbo.TI_TransactionTable
ON dbo.TransactionTable
AFTER INSERT
AS
SET NOCOUNT ON
UPDATE dbo.TargetTable
SET StatusFlag = ' '
WHERE StatusFlag <> ' '
AND EXISTS
(
SELECT *
FROM inserted I
WHERE I.LotJob = dbo.TargetTable.LotNumber
AND I.TrnQuantity = dbo.TargetTable.ReceiptQty
AND...
February 21, 2011 at 9:48 am
-- either (LEN ignores trailing spaces)
LEFT(vm.VCTCollectZipcodeId, LEN(vhml.ZipcodeFrom)) = vhml.ZipcodeFrom
-- or
vm.VCTCollectZipcodeId LIKE vhml.ZipcodeFrom + '%'
February 21, 2011 at 4:55 am
There are some MDX articles in the Stairways menu, above Forums, on SSC.
February 18, 2011 at 4:01 am
Obviously you have to use the PATINDEX to do the SUBSTRING:
-- *** Test Data ***
CREATE TABLE #t
(
Grade varchar(8000) NULL
)
INSERT INTO #t
SELECT 'R1 - Background, M0 - No Maculopathy'
UNION ALL SELECT...
February 17, 2011 at 6:31 am
DELETE dbo.Table_2
WHERE EXISTS
(
SELECT *
FROM dbo.Table_1 T1
WHERE T1.[UNIQUE #] = Table_2.[UNIQUE #]
AND T1.[SEQ ORDER #] = Table_2.[SEQ ORDER #]
)
February 16, 2011 at 10:52 am
We run separate instances for thrid party products where they insist that they need sysadmin rights to the instance in order to provide support.
We tend to run all our internally...
February 16, 2011 at 7:15 am
;WITH Grp
AS
(
SELECT *
,ROW_NUMBER() OVER (PARTITION BY user_id ORDER BY trans_time)
- ROW_NUMBER() OVER (PARTITION BY user_id, trans_type ORDER BY trans_time) AS Grp
FROM dbo.user_trans
)
,GrpNoDups
AS
(
SELECT user_id, trans_type, grp
,MIN(trans_time) AS trans_time
FROM Grp
GROUP BY user_id,...
February 15, 2011 at 11:55 am
I suspect SalesHeader has a foreign key to Contact. Try:
DELETE SalesHeader WHERE ContactId = 10
DELETE Contact WHERE ContactId = 10
February 15, 2011 at 11:17 am
-- *** Test Data ***
CREATE TABLE #t
(
Col1 char(1) NOT NULL
,Col2 int NOT NULL
)
INSERT INTO #t
SELECT 'A', 1
UNION ALL SELECT 'A', 2
UNION ALL SELECT 'A', 3
UNION ALL SELECT 'B', 4
UNION ALL...
February 15, 2011 at 9:20 am
I cannot remember if SQL2000 gave a specific exception if you tried to restore a backup produced by a more recent version of SQL server.
It may be worth finding out...
February 15, 2011 at 8:27 am
As sometimes excessive data validation can cause users not to enter anything, another approach is to produce regular data quality reports grouped by department, user etc.
If management want information based...
February 15, 2011 at 6:04 am
Viewing 15 posts - 766 through 780 (of 1,494 total)