Viewing 15 posts - 1,006 through 1,020 (of 1,491 total)
You can update a derived table:
UPDATE D
SET seqCol = RowId
FROM
(
    SELECT ROW_NUMBER() OVER (PARTITION BY FK_ID ORDER BY CreationDate) AS RowId
        ,seqCol
    FROM tab1
    WHERE FK_ID = 6
) D
February 23, 2009 at 4:14 am
My experience of joins in subqueries is that they always end up as nested loops. This can be very inefficient with large tables. (Check your query plans to confirm this.)
I...
February 17, 2009 at 8:30 am
On the information you have given us so far 23000 is the correct number of rows to be updated.
Plug your query into the following test data, look at the results...
February 13, 2009 at 7:17 am
This is a classic example of why you should not use TSQL type UPDATEs unless you know
what you are doing. (We insist on ANSI UPDATEs in production code unless a...
February 13, 2009 at 5:21 am
I suspect you should be doing something with the inserted pseudo-table.
If the primary key on CANDIDATE is candidateId then something like:
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
ALTER TRIGGER dbo.CC_TR_CANDIDATE_PF
ON dbo.CANDIDATE
AFTER UPDATE
AS
BEGIN
    SET NOCOUNT...
February 13, 2009 at 3:46 am
Did you run the OR (T.Id1 = 0 AND T.Id2 = 0 AND T.Id3 = 0) part of the query?
February 13, 2009 at 2:59 am
At a guess:
UPDATE mandiflex.dbo.TABATOPCO
SET U_NCONSUMO = 1
WHERE EXISTS
(
    SELECT *
    FROM mandiflex.dbo.tabat T
    WHERE EXISTS
        (
            SELECT *
            FROM prodiflex.dbo.st S
            WHERE T.cod_art = S.ref
                AND S.familia ='MP208'
        )
        -- assumming link between tabat and TABATOPCO is st_tabatphc in both...
February 12, 2009 at 11:48 am
-- *** Test Data ***
DECLARE @t TABLE
(
    srno int NOT NULL
    ,FName varchar(20) NOT NULL
    ,LName varchar(20) NOT NULL
    ,dob datetime NOT NULL
    ,batch varchar(10) NOT NULL
    ,Id1 int NOT NULL
    ,Id2 int NOT NULL
    ,Id3 int NOT...
February 12, 2009 at 10:44 am
-- *** Test Data ***
DECLARE @t TABLE
(
    Line varchar(50) NOT NULL
)
INSERT INTO @t
SELECT 'UserLogon Logon "Domain\Username" from blah' UNION ALL
SELECT 'Junk' UNION ALL
SELECT '"Junk2' UNION ALL
SELECT 'UserLogon Logon "Domain\Username2"'
-- *** End...
February 12, 2009 at 9:23 am
SELECT Acno, [Date], NodeName
FROM
(
    SELECT ROW_NUMBER() OVER (PARTITION BY AcNo ORDER BY [Date] DESC) AS RowId
        ,Acno, [Date], NodeName
    FROM YourTable
) D
WHERE RowId = 1
ORDER BY AcNo DESC
February 12, 2009 at 7:32 am
Derek – sorry for the confusion but my question was aimed at the OP as he seemed to be relying on the order the data was placed in the tables.
My...
February 10, 2009 at 3:38 am
Do you realize that a table is an UNORDERED set?
As long as you are prepared to order TableA by Id and TableB By Loc,
which may not make sense with real...
February 9, 2009 at 10:16 am
Very, very nice!
I think the SELECT p.ID, p.theValue, p.theCol should be either:
SELECT p.*
or
SELECT p.ID, p.bit01, p.bit02 ...
February 6, 2009 at 4:32 am
Viewing 15 posts - 1,006 through 1,020 (of 1,491 total)