Forum Replies Created

Viewing 15 posts - 46 through 60 (of 2,894 total)

  • RE: Alter table performance

    Use ALTER TABLE

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: If Else logic

    --Requirement : If i pass 0 then it has to get the rows corresonding to (IsSalaryApproved = 0) else it has to bring all the records.

    You can do:

    select * ...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: How to get a consecutive count based on the first value

    Stephanie Giovannini (1/14/2015)


    Even if it's readable, I wouldn't suggest using Stephanie's code. It reads the table 7 times which can become a nightmare on large tables.

    Agreed. The other two candidate...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: wait for delay inside a fuction

    Why would you want it in function? Whatever reason, it would be highly unrecommened.

    However you can use dummy loop:

    declare @dtStart datetime=getutcdate()

    ...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: ROW_NUMBER() OVER (PARTITION BY *** ORDER BY ***) excluding NULL values

    "CASE WHEN"-less query also possible for ColC of string type:

    SELECT [ID]

    , ColC

    , LEN(ColC)-LEN(ColC)+ROW_NUMBER() OVER(PARTITION BY NULLIF(ISNULL(colC,''), colC) ORDER BY [ID])

    FROM #test1

    ORDER BY...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: ROW_NUMBER() OVER (PARTITION BY *** ORDER BY ***) excluding NULL values

    With a given data type of your ColC column, you can do the same without any CASE WHEN:

    SELECT [ID]

    , ColC

    , ColC-ColC+ROW_NUMBER() OVER(...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: "Best Practices" Questions

    I think this list is missing one extremely important "Best Practices" point:

    #7 Never connect to SQL SERVER by any means and never try to run any query against it as...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Read dynamic XML

    You should be able to modify the following as per your requirements:

    declare @p xml = '<root>

    <DOCTOR.SSN>

    <OldValue />

    <NewValue>111111111</NewValue>

    <DisplayName>Social Security Number</DisplayName>

    </DOCTOR.SSN>

    <DOCTOR.EMAILADDRESS>

    <OldValue>abc.com</OldValue>

    <NewValue>Julietest@yahoo.com</NewValue>

    <DisplayName>Email Address</DisplayName>

    </DOCTOR.EMAILADDRESS>

    ...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Read dynamic XML

    What kind of output do you want?

    Your output example doesn't represent recordset...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: query/script/stored procedure which will return a single table with three columns

    Try this first:

    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    or wait for someone who will do it for you...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Add Auto Incrementing column to my SELECT statement

    You can generate number on fly without using identity:

    SELECT CONVERT(VARCHAR(6), GETDATE(), 12) + 'GP' +

    RIGHT('00000' + CAST(ROW_NUMBER() OVER (ORDER BY (SELECT...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Multiple Condition CASE Statement or Sub-Queries

    sclayton 889 (1/12/2015)


    I will try this. Seems more understandable the multiple case statement one of my colleagues suggested.

    The conditions are not really too complicated here and I would recommend...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Multiple Condition CASE Statement or Sub-Queries

    1. to ignore(not delete) records that have an enterDate equal to either a conversiondate of '2010-01-01' OR a termDate of '2001-01-01'; If they do, use the processDate to select instead...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: tempdb blocking

    Adam Bean (12/11/2014)


    After some more digging and testing, it would seem that a SELECT INTO does indeed lock some of the system tables.

    We're now starting to dissect performance between SELECT...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: growth above normal log database!

    I would recommend this for reading:

    http://www.brentozar.com/archive/2013/09/index-maintenance-sql-server-rebuild-reorganize/

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

Viewing 15 posts - 46 through 60 (of 2,894 total)