Forum Replies Created

Viewing 15 posts - 16 through 30 (of 49 total)

  • RE: Need help to built T-SQL

    It's enough as follow,

    set transaction isolation level repeatable read

    begin tran

    declare @tInfo table

    (TID varchar(30), DDate datetime, RID varchar(30), Posi tinyint, BusN varchar(10),

    TripN varchar(10), Stat varchar(1), Cflg varchar(1), Iflg varchar(1));

    ;WITH CTE...

  • RE: Need help to built T-SQL

    Based on your guidance, below is my latest statement,

    declare @tInfo table

    (TID varchar(30), DDate datetime, RID varchar(30), Posi tinyint, BusN varchar(10),

    TripN varchar(10), Stat varchar(1), Cflg varchar(1), Iflg varchar(1));

    ;WITH CTE AS

    (

    select...

  • RE: Need help on T-SQL

    lmu92 (6/13/2010)


    When thinking about it again:

    Why do you need to have separate tables per month?

    Do you have to deal with such a large data volume? Did you consider horizontal partitioning?

    Yes...

  • RE: Need help on dynamic SQL

    tq sir. your guidance is my inspiration

  • RE: Need advice to prevent Insert

    Hello Sir,

    tq very much. your guidance is my inspiration

  • RE: If record not found, then insert else update

    Me run as follow,

    --== FIRST LETS UPDATE THE DATA INTO THE SECOND TABLE

    --== IF THE ROWS DOES EXIST

    UPDATE T2

    SET T2.Posi = T1.Posi

    FROM

    #tPosi T2

    INNER JOIN

    ...

  • RE: Have some question

    tq to all. i'll learn to using Books Online

  • RE: Have some question

    tq to all.

  • RE: Need help to insert a row in 1 table into 2 tables

    So far, me can insert into #tripH as follow,

    CREATE TABLE #tripH

    (idx smallint identity(1,1),timerHidx smallint, troutehidx smallint,

    seq tinyint,dprtdte smalldatetime);

    insert into #tripH

    SELECT timerHidx ,troutehidx , seq ,dprtdte

    FROM

    (SELECT ROW_NUMBER() OVER (PARTITION BY ...

  • RE: Need help to built query

    Hi sir,

    It's work. 😀

  • RE: Need help to insert XML Data into 2 tables

    Dear Sir,

    After a week, your guidance solved my problem.

    tq very much

  • RE: Need help to insert XML Data into 2 tables

    Sir, so far i've as follow,

    declare @idx smallint

    declare @data xml

    set @data='<trips>

    <trip>

    <routeh>1</routeh>

    <seq>1</seq>

    <tripnme>trip1</tripnme>

    <dprtweekday>1011101</dprtweekday>

    <dprttimes>

    <dprttime routed="6">9:00AM</dprttime>

    <dprttime routed="7">2:30PM</dprttime>

    </dprttimes>

    </trip>

    <trip>

    <routeh>1</routeh>

    <seq>2</seq>

    <tripnme>trip2</tripnme>

    <dprtweekday>1110001</dprtweekday>

    <dprttimes>

    <dprttime routed="6">11:00AM</dprttime>

    <dprttime routed="7">4:30PM</dprttime>

    </dprttimes>

    </trip>

    </trips>'

    DECLARE @INSERTED_VALUES table

    (idx int,

    [troutehidx] [smallint] NOT NULL,

    [seq] [tinyint] NOT NULL

    )

    insert into dbo.tRouteTimerHx...

  • RE: Need help to insert XML Data into 2 tables

    lmu92 (3/10/2010)


    My first advice is to get rid of the

    custom data type.

    It won't add any value to your code or database structure. Instead it will

    cause pain to maintain...

  • RE: How to using trigger to prevent a rubbish record

    ok sir. will take not on that

  • RE: How to using trigger to prevent a rubbish record

    lmu92 (3/7/2010)


    What is the reason not to use a foreign key?

    Seems like the appropriate solution for the requirement.

    Now, i'm drop tH and using foreign key as follow,

    CREATE TABLE [dbo].[tH](

    [idx] [smallint]...

Viewing 15 posts - 16 through 30 (of 49 total)