Forum Replies Created

Viewing 15 posts - 271 through 285 (of 345 total)

  • RE: delete records by day

    This will fix what you have:

    declare @startdate Datetime

    declare @enddate Datetime

    set @startdate = getdate()-480

    set @enddate = getdate()-90

    --set @vStart = select convert(varchar,@startdate, 102)

    print @startdate

    print @enddate

    WHILE (@startdate < @enddate)

    BEGIN

    print 'delete from vending where...

    ______________________________________________________________________________
    How I want a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.

  • RE: T SQL Trigger on certain columns

    I think you're looking for something like this:

    CREATE TRIGGER trigger_test ON test FOR UPDATE

    AS

    SET NOCOUNT ON

    IF UPDATE(column9) OR UPDATE(column10) OR UPDATE(column11)

    BEGIN

    --do your main DML here

    END

    ______________________________________________________________________________
    How I want a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.

  • RE: SET ROWCOUNT

    Not only confusing, but dangerous! I'm reading Defensive Database Programming by Kuznetsov and he describes where any triggers on the table in the code above will be affected by the...

    ______________________________________________________________________________
    How I want a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.

  • RE: SET ROWCOUNT

    Ajay.Kedar (4/25/2011)


    BOL is right, Ser rowcount overwrites the TOP function used in select statement. The statements will get executed from right to left so first Select statement will get executed...

    ______________________________________________________________________________
    How I want a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.

  • RE: SET ROWCOUNT

    SQLkiwi (4/24/2011)


    toddasd (4/21/2011)


    I didn't know INSERT could have a TOP clause.

    It's a good thing to know, because SET ROWCOUNT will not work with INSERT, DELETE, or UPDATE in the next...

    ______________________________________________________________________________
    How I want a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.

  • RE: SET ROWCOUNT

    opc.three (4/21/2011)


    TOP also works with INSERT directly. So this is the case BOL was talking about:

    I didn't know INSERT could have a TOP clause. Now it makes sense. Thank you.

    ______________________________________________________________________________
    How I want a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.

  • RE: Service Broker

    I've been reading about Service Broker with these questions lately and I still have a lot of questions on what exactly it is (even after reading BOL). Anyone here use...

    ______________________________________________________________________________
    How I want a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.

  • RE: Acces Database from offshore

    You're in the wrong forum. This has very little to do with SQL Server. My company also has many databases offshore and do you know what I do when I...

    ______________________________________________________________________________
    How I want a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.

  • RE: One reader at a time

    Your UDF is based on getting the next box number of that day's orders. So I'm saying don't join tblOrders to avoid locking it and instead pass the procedure the...

    ______________________________________________________________________________
    How I want a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.

  • RE: Combining Multiple Datasets

    Multiple columns (not fields) won't matter. Try it out and you'll see that they are tacked on to the end of the rows just like a scalar total. You'll only...

    ______________________________________________________________________________
    How I want a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.

  • RE: Combining Multiple Datasets

    Yes, you can tack on as many as you like if your additional queries return one value. If they contain more than one row, your results will cross-multiply and we'll...

    ______________________________________________________________________________
    How I want a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.

  • RE: Combining Multiple Datasets

    Ah, I thought you would copy the whole queries from the first post into the parenthesis. If these are views, then just remove the parenthesis.

    SELECT *

    FROM...

    ______________________________________________________________________________
    How I want a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.

  • RE: Combining Multiple Datasets

    Copy and paste what you currently have.

    ______________________________________________________________________________
    How I want a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.

  • RE: Combining Multiple Datasets

    db2mo (4/18/2011)


    What field would I join on? There are multiple fields in the first dataset and only one field in the second dataset.

    None, just paste your queries where I...

    ______________________________________________________________________________
    How I want a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.

  • RE: Money and Decimal Datatypes

    A mental point to myself for thinking about the answer and then executing it 😀 It's almost like not cheating!

    ______________________________________________________________________________
    How I want a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.

Viewing 15 posts - 271 through 285 (of 345 total)