Forum Replies Created

Viewing 15 posts - 61 through 75 (of 239 total)

  • RE: Horrible response time with Update Query

    It looks like there is a lot of Parallelism going on.  Try adding OPTION (MAXDOP 1) to the end of the query and see if that changes anything.

  • RE: Bad performance in TSQL

    A couple of things:

    How many rows are in each table? Are being inserted?

    How are you running it when it takes 6 hours to run? 1 minute to run?

    Remove 'AND PTY_Party_Code...

  • RE: update statement trouble

    A table modifier is allowed in the assignee side of an update.  The following works perfectly well.

    DECLARE @table1 TABLE (id int, data varchar(5) null)

    INSERT @table1 values(1, null)

    INSERT @table1 values(2, null)

    DECLARE...

  • RE: Update rows

    Try this:

    DECLARE @Table1 table(BP_Period int, Matter_Code int, BP_At_Time int NULL)

    INSERT @table1 values(200301, 640559, NULL)

    INSERT @table1 values(200402, 640559, NULL)

    INSERT @table1 values(200503, 640559, NULL)

    INSERT @table1 values(200504, 640559, NULL)

    INSERT @table1 values(200605, 640559, NULL)

    INSERT...

  • RE: Calculate balance for activity report

    This will work but I don't know how it will perform with a large number of rows in the transaction table.

    DECLARE @begbal TABLE (customer varchar(20), balance int, baldate datetime)

    insert @begbal...

  • RE: spid(#) at the bottom of the Query Analyser window

    It's always there for each query window.  From left to right, the status bar reads:

    Ready | servername | login(SPID) | Database | query time | rowcount | cursor position

  • RE: Insert records from one table to multiple tables

    Try something like this to avoid cursors:

    --create tables

    create table source(username varchar(255) PRIMARY KEY, firstname varchar(255), lastname varchar(255), address varchar(255))

    create table person(personid int PRIMARY KEY, username varchar(255), firstname varchar(255), lastname varchar(255),...

  • RE: Problem with FTP Task on SSIS in SQL2005

    Repost this to the correct forum if you want help.  This is the SQL 2000 Newbies forum.

  • RE: Concatenating from Look up Table

    Try this:

     

    create table lut ( id1 INT, id2 INT )

    insert lut (id1,id2) values (1, 1)

    insert lut (id1,id2) values (1, 4)

    insert lut (id1,id2) values (1, 5)

    insert lut (id1,id2) values (2, 2)

    insert...

  • RE: Loop through a table

    This may help solve your problem without using a loop and using data normalization to not duplicate data.

    --Build a table of numbers, you may want to make it a real...

  • RE: Tricky data manipulation scenario

    If GID changes is unique to a row, then you can use the following:

    declare @Input table(gid int, sname varchar(50), fname varchar(50))

    insert @Input values (1, 'Mathew Levey', 'Mark Bell')

    insert @Input values...

  • RE: Tricky data manipulation scenario

    SQL never guarantees the order unless an ORDER BY clause is used.  The order that they are entered or in the table is not guranteed.  Given your data, what would you...

  • RE: Full Join

    I believe the following will work.  You'll have to substitue your getmonthstart function where necessary.

    declare @Historical table(startdate datetime, account varchar(50), amount money)

    declare @Future table(startdate datetime, account varchar(50), amount money)

    insert @Historical...

  • RE: Tricky data manipulation scenario

    Try this:

    declare @Input table(gid int, sname varchar(50), fname varchar(50))

    insert @Input values (1, 'Mathew Levey', 'Mark Bell')

    insert @Input values (1, 'San Gordon', 'Mark Bell')

    insert @Input values (1, 'Larry Gomes', 'Mark Bell')

    insert...

  • RE: Divide by Zero Error

    Does this help:

     

    SELECT case when floortotal <> 0 then fnWTRalldata.floortotocc / fnWTRalldata.floortotal

                else 0 end AS floorspaceperc,

           case when floortotal <> 0 then (fnWTRalldata.NetRent / fnWTRalldata.FinalRtLsincSC) - 1

                else...

Viewing 15 posts - 61 through 75 (of 239 total)