Viewing 15 posts - 1,651 through 1,665 (of 2,171 total)
Oh, but then you need to learn to read execution plans, right?
April 16, 2007 at 6:21 am
Yes, you get the same execution plan.
But still, you have to do a JOIN which means you get an extra, depending on index, index seek/scan or table scan.
April 16, 2007 at 4:47 am
Well, Jeff has a CROSS JOIN, so there is a little performance penalty.
April 16, 2007 at 4:13 am
DELETEt1
FROM(
SELECTROW_NUMBER() OVER (PARTITION BY AccountNo ORDER BY MyDateTime DESC) AS RecID
FROMTable1
) AS t1
WHERERecID > 1
April 16, 2007 at 3:32 am
Or, if you use SQL Server 2005,
DELETEt1
FROM(
SELECTROW_NUMBER() OVER (PARTITION BY Col1 ORDER BY Col2 DESC) AS RecID
FROMTable1
) AS t1
WHERERecID > 1
April 16, 2007 at 3:29 am
His professor will notice that the code is not written by him.
It is out of his style, if he needs to question for help.
I know some of my occasional students...
April 15, 2007 at 4:17 am
Hey, you know me...
At least I didn't write
sp_msforeachdb 'drop database ''?''' or similar.
April 15, 2007 at 2:56 am
-- Prepare sample data
DECLARE @Emp1 TABLE (Emp INT)
INSERT @Emp1
SELECT 101 UNION ALL
SELECT 102 UNION ALL
SELECT 103 UNION ALL
SELECT 104
DECLARE @Emp2 TABLE (Emp INT)
INSERT @Emp2
SELECT 101 UNION ALL
SELECT 102...
April 14, 2007 at 9:26 am
There are at least three SET-BASED methods you can use
1) FULL JOIN
2) UNION ALL with GROUP BY
3) UNION ALL with LEFT JOIN
April 14, 2007 at 9:06 am
-- Prepare sample data
DECLARE
@Sample TABLE (ClientID INT, PaySourceID INT,
April 13, 2007 at 5:00 pm
Select CASE WHEN CharIndex('Offset', Description) > 0 THEN 1 ELSE 0 END As IsOffset From etc Where etc Order By IsOffset
April 13, 2007 at 11:37 am
SELECT
CAST(LEFT(DataRow, PATINDEX('%[^0-9]%', DataRow) - 1) AS bigint) AS QuestionNo
,CAST(SUBSTRING(DataRow, PATINDEX('%[^0-9]%', DataRow) + 1, 8000) AS bigint) AS AnswerNo
FROM (
SELECT '02245A555115555155' AS DataRow
) AS YourTable
April 13, 2007 at 11:35 am
Don't apologize. You and me are onthe same track.
We only have to convince Gary.
April 13, 2007 at 10:31 am
I thought I was crystal clear, super green, in my answer.
April 13, 2007 at 10:18 am
CREATE PROCEDURE dbo.uspDeleteWithProjectID
(
@ProjectID INT
)
AS
DELETE TableA WHERE ProjectID = @ProjectID
DELETE TableB WHERE ProjectID = @ProjectID
DELETE TableC WHERE ProjectID = @ProjectID
April 13, 2007 at 7:47 am
Viewing 15 posts - 1,651 through 1,665 (of 2,171 total)