Forum Replies Created

Viewing 15 posts - 856 through 870 (of 2,171 total)

  • RE: divide data into partitions

    For performance, yes. But SQL Server takes care of the filtering for you.

    See this picture. This is the execution plan when having Status = 2 in the WHERE statement.

    A nice...


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: divide data into partitions

    When you update the status, the SQL Server automatically rearrange the records to the correct table/partition.

    See the execution plans in the link above.


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Improve my where loop!

    Thank you for your feedback.

    I think this can be done with 12 insert statements (one for each source table to archive target table).

    You can process all records for a table...


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: divide data into partitions

    See if this blog post about horizontal partitioning helps you

    http://weblogs.sqlteam.com/peterl/archive/2007/09/24/Horizontal-partitioning.aspx

    You can do the same with your data.

    Have a composite key with a new column named "HighProfileProject" which is 1...


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Improve my where loop!

    I accept your apologize. I believe you are sincere about it.

    As for the original question, we don't really know what the loop/cursor is for, do we?

    All we know is that...


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: How to insert specific column values into a table using BULK INSERT?

    sharma (6/11/2008)


    Hi How the format file would be for above ?

    Since we don't know your column name nor the file layout you will have to do some work for yourself...


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Improve my where loop!

    I use table variable just for convenience.

    You can use temp tables as well.

    SET NOCOUNT ON

    CREATE TABLE#Sample

    (

    i INT,

    Done TINYINT

    )

    INSERT#Sample

    SELECT1, 0 UNION ALL

    SELECT2, 1 UNION ALL

    SELECT3, 0

    DECLARE @i INT

    SELECT@i = MIN(i)

    FROM#Sample

    WHEREDone =...


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Improve my where loop!

    I believe you are wrong Sergiy, again.

    SET NOCOUNT ON

    DECLARE@Sample TABLE (i INT, Done TINYINT)

    INSERT@Sample

    SELECT1, 0 UNION ALL

    SELECT2, 1 UNION ALL

    SELECT3, 0

    DECLARE @i INT

    SELECT@i = MIN(i)

    FROM@Sample

    WHEREDone = 0

    WHILE @i IS NOT...


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Improve my where loop!

    DECLARE @PNo NUMERIC(10,0)

    SELECT@PNo = MIN(PNo)

    FROMPT

    WHEREPDone = 0

    WHILE @PNo IS NOT NULL

    BEGIN

    ...

    UPDATEPT

    SETPDone = 1

    WHEREPNo = @PNo

    SELECT@PNo = MIN(PT)

    FROMPT

    WHEREPDone = 0

    END


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Improve my where loop!

    DECLARE @PNo NUMERIC(10,0),

    @Counter INT,

    @CounterMAX INT

    CREATE TABLE#PT

    (

    RowNum INT IDENTITY(1, 1) PRIMARY KEY,

    PT DATETIME,

    PNo NUMERIC(10,0),

    PVer NUMERIC(2,0),

    PAction CHAR(1),

    PDone BIT

    )

    INSERT#PT

    (

    PT,

    PNo,

    PVer,

    PAction,

    ...


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: How to insert specific column values into a table using BULK INSERT?

    Books Online says you should use a format file, so I would try that first.

    Or simply

    INSERT TargetTable (Col1, Col2, Col3, Col4)

    SELECT ColBlue, ColGreen, ColRed, ColWhite

    FROM OPENROWSET (....) AS c


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Invalid sorting date colume in .net

    Also asked and answered here

    http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=104588


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Number of weeks count.

    CREATE FUNCTIONdbo.fnWeekDiff

    (

    @Date1 DATETIME,

    @Date2 DATETIME

    )

    RETURNS INT

    AS

    BEGIN

    RETURN1 + ABS(DATEDIFF(DAY, '19000101', @Date1) / 7 - DATEDIFF(DAY, '19000101', @Date2) / 7)

    END

    GO

    DECLARE@Date1 DATETIME,

    @Date2 DATETIME

    SELECT@Date1 = '20080602',

    @Date2 = '20080608'

    SELECTdbo.fnWeekDiff(@Date1, @Date2),

    dbo.fnWeekDiff(@Date2, @Date1)


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: how to select top 2 row from emp table

    SELECT REPLACE(CONVERT(CHAR(11), GETDATE(), 106), ' ', '-')


    N 56°04'39.16"
    E 12°55'05.25"

  • RE: Curley Braces in T/SQL?

    Duplicate post

    http://www.sqlservercentral.com/Forums/Topic514126-8-1.aspx


    N 56°04'39.16"
    E 12°55'05.25"

Viewing 15 posts - 856 through 870 (of 2,171 total)