Forum Replies Created

Viewing 15 posts - 2,446 through 2,460 (of 8,731 total)

  • RE: Syntax issue

    You're missing the begin and a different set of begin...end. You're also missing the commit transaction. You're also using the slow option.

    BEGIN TRANSACTION;

    IF EXISTS(SELECT * FROM db1.dbo.Jobs where status in...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Running totals within Cursors, Can I replace with something better?

    There are 2 other ways that might possibly help you.

    One is to use the window functions capabilities introduced in SQL Server 2012: http://sqlmag.com/sql-server-2012/how-use-microsoft-sql-server-2012s-window-functions-part-1

    The second one is to use the Quirky...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Simple Aggregate function.

    Anandkumar-SQL_Developer (7/25/2016)


    --input code :

    CREATE TABLE SumPositiveNegative

    (

    ID INT

    )

    GO

    INSERT INTO SumPositiveNegative VALUES

    (1),

    (-1),

    (2),

    (-1),

    (3),

    (-3)

    GO

    select * from SumPositiveNegative

    -- Expected_output :

    SumIgnoring-ve_symbolsTotalSum+VeSum-VeSum

    11 ...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: I need to change the column headings to start with a letter what would be the best way to do this.

    Yes, that's why we have column alias. Remove the star(*) and explicitly list the columns and add alias as needed.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Need Help! ETL Stored Procedure Used to Work but Now Very Slow

    It seems that you're not managing the log adequately, as previously stated. You can either change the recovery mode to simple and lose the benefits of minimal data-loss or you...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Exclude zero till get first nonzero value.(use cte or select)

    Anandkumar-SQL_Developer (7/25/2016)


    Hi this code also work :

    SELECT Value

    FROM

    #first_nonzero

    WHERE %%PhysLoc%% >=

    ...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Temp Table vs Permenant Table

    ChrisM@home (7/22/2016)


    Post your code. Reduce the pointless guesses. Thanks.

    +1

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Are the posted questions getting worse?

    Brandie Tarvin (7/22/2016)


    jasona.work (7/22/2016)


    So I'm sitting here, and I just realized I've got a grin on my face from getting something to work...

    Crafting up some easy-to-use backup reports that the...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: SP w/ Dynamic SQL Works, Sometimes

    Ahem...

    Luis Cazares (7/22/2016)


    Have you tried printing the statements before executing them? Maybe a null is giving you problems.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Today's Random Word!

    Grumpy DBA (7/22/2016)


    Revenant (7/22/2016)


    Ed Wagner (7/22/2016)


    Luis Cazares (7/22/2016)


    crookj (7/22/2016)


    Red

    Blue

    Sky

    Rainbow

    Pot o' gold

    leprechaun

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Today's Random Word!

    crookj (7/22/2016)


    Red

    Blue

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Set Date based on day of Month

    ben.brugman (7/22/2016)


    Luis Cazares (7/21/2016)


    Similar logic, shorter version.

    SELECT DATEADD(month,12*(YEAR(GETDATE())-1902)+3,0)

    This is a bit 'short' I would guess:

    SELECT DATEADD(month,12*(YEAR('20160401')-1902)+3,0) -- Result 2014-04-01 00:00:00.000

    SELECT DATEADD(month,12*(YEAR('20160331')-1902)+3,0) --...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: SP w/ Dynamic SQL Works, Sometimes

    Have you tried printing the statements before executing them? Maybe a null is giving you problems.

    I would suggest that you follow twin devil's recommendations. I disagree on the reason for...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Merge Two Queries !!

    Just add the column to your first query. Here's a shorter version.

    SELECT h.server

    , j.name

    , h.run_date

    ,...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: How do I add a constraint to a column

    CELKO (7/21/2016)


    SQL is what I would call a "predicate language"; instead of looking for assembly language style flags in the data like we did in the 1960's, we use predicates...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

Viewing 15 posts - 2,446 through 2,460 (of 8,731 total)