Forum Replies Created

Viewing 15 posts - 1 through 15 (of 42 total)

  • RE: Getting records in 1 sql statement

    Dave Ballantyne (6/18/2010)


    Absolutely.

    Since 2 is just a subset of 1 , try something like ...

    Sum(case when datediff(mn,DateTimeIn, DateTimeOut) < 60 then 1 else 0 end)

    Additionally , you...

  • RE: How to reduce a large db log file size

    GilaMonster (12/8/2009)


    setlan1983 (12/7/2009)


    May I know what is the proper way to reduce the log file size?

    The proper way is to schedule regular log backups so that the space in...

  • RE: How to reduce a large db log file size

    Elliott W (12/7/2009)


    Is the database configured for full or simple recovery. I'm guessing full..

    You could do:

    DUMP TRANSACTION databasename WITH NO_LOG

    GO

    DUMP TRANSACTION databasename WITH TRUNCATE_ONLY

    GO

    That should clear up the log..

    CEWII

    The...

  • RE: How to reduce a large db log file size

    Elliott W (12/7/2009)


    I believe DBCC SHRINKFILE is available in SQL 2000.. Look at that..

    CEWII

    Tried, but the size not decreasing... still 12GB :pinch:

  • RE: Insert Trigger

    Jack Corbett (12/1/2009)


    If you haven't processed any rows yet then all the rows will be returned.

    Hmm... I still not very clear about that.

    A temporarily table "@eps" was created to hold...

  • RE: Insert Trigger

    Jack Corbett (11/30/2009)


    Note the WHERE clause on the snippet. I load all the rows with a NULL ProcessedDate into the @emps table variable, process the rows. Then use...

  • RE: Insert Trigger

    Jack Corbett (11/16/2009)


    A simple, T-SQL only process would be something like this (not tested so you may have to make some changes):

    CREATE TABLE EmployeeQueue

    (

    ...

  • RE: Insert Trigger

    Jack Corbett (11/14/2009)


    A job could call a stored procedure (my preferred method) or it could just be T-SQL.

    You'd have to write a windows service, probably use .NET, that reads unprocessed...

  • RE: Insert Trigger

    Jack Corbett (11/13/2009)


    Okay, I have a couple of comments about your situation.

    1. Don't do it this way. You do not want a trigger to have to do anything...

  • RE: Insert Trigger

    CREATE TRIGGER [tr_Emp] ON [Employee]

    FOR INSERT

    AS

    DECLARE

    @EmpID varchar(20),

    @EmpName varchar(100)

    SELECT @EmpID=INSERTED.EmpID, @EmpName=INSERTED.EmpName

    FROM INSERTED

    BEGIN

    SET NOCOUNT ON;

    IF @EmpID IS NOT NULL

    BEGIN

    INSERT INTO [ServerName].[DBName].[Employee] (EmpID, EmpName)

    VALUES (@EmpID, @EmpName)

    END

    END

    GO

    Is this correct?

  • RE: declare cursor select from another database table

    WayneS (10/8/2009)


    setlan1983 (10/8/2009)


    Btw, why need put double dot before "Table1"? Why not single dot?...

    But if I want archive the following:

    1. "SELECT Sum(SalesAmt) AS TotalSales, COUNT(*) AS TotalTrans FROM DB_A.Sales WHERE...

  • RE: declare cursor select from another database table

    Mark-101232 (10/8/2009)


    setlan1983 (10/8/2009)


    Mark-101232 (10/8/2009)


    setlan1983 (10/8/2009)


    Mark-101232 (10/8/2009)


    See if this helps

    CREATE TABLE Table1 (

    column1 int,

    column2 int

    )

    INSERT INTO Table1(column1,column2) VALUES(10,20)

    DECLARE @DBName VARCHAR(128)

    DECLARE @column1 INT

    DECLARE @column2...

  • RE: declare cursor select from another database table

    Mark-101232 (10/8/2009)


    setlan1983 (10/8/2009)


    Mark-101232 (10/8/2009)


    See if this helps

    CREATE TABLE Table1 (

    column1 int,

    column2 int

    )

    INSERT INTO Table1(column1,column2) VALUES(10,20)

    DECLARE @DBName VARCHAR(128)

    DECLARE @column1 INT

    DECLARE @column2 INT

    SET @DBName=DB_Name()

    EXEC...

  • RE: declare cursor select from another database table

    Mark-101232 (10/8/2009)


    See if this helps

    CREATE TABLE Table1 (

    column1 int,

    column2 int

    )

    INSERT INTO Table1(column1,column2) VALUES(10,20)

    DECLARE @DBName VARCHAR(128)

    DECLARE @column1 INT

    DECLARE @column2 INT

    SET @DBName=DB_Name()

    EXEC ('DECLARE cur1...

  • RE: Timeout Expired

    Elliott W (9/17/2009)


    For Case A I would say you have some blocking going on, definitely see who is doing it.

    For Case B I would say indexing and tuning sounds right....

Viewing 15 posts - 1 through 15 (of 42 total)