Forum Replies Created

Viewing 15 posts - 32,356 through 32,370 (of 59,099 total)

  • RE: Query Running Slow due to IS NULL in Where Clause.

    Satnam Singh (10/8/2011)


    I will upload the execution plan in short while, meanwhile the query is as follows:

    Select wooBillingAmount_Cp,worIsBillable,bcoUserValue1,bcoID,sctFullName_Cp,cstAddress1,cstAddress2,cstCity,convert(varchar(4000), worCstComment) as worCstComment,rptCstCountryShortDesc,rptCstCountryId,cstCompanyName,cstNum,rptCstStateShortDesc,rptCstStateId,cstPostCode,convert(datetime,convert(nvarchar, worFoundWhen, 107)) as worFoundWhen,worDiscussed,worEstTimeForRepairQty,dateadd(mi, -(IsNull((select tzlBiasInMinutes from vewShatimezoneLookup where...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: PIVOT FOR DYNAMIC ROWS

    The following article will tell you how to do it...

    http://www.sqlservercentral.com/articles/Crosstab/65048/

    If you want a coded reply, the following article will tell you how to get one...

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

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: Wierd month problem

    ramadesai108 (10/7/2011)


    Hello All,

    Have a need where I pass in the start month and end month as an ints to a stored proc. The data has hard...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: How Do You Handle Database Documentation?

    dmoutray (10/5/2011)


    I've been digging into database documentation at work lately. It's the same old song. Very little documentation exists. The documentation that does exist is so out...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: store procedure over a list

    seftest_09 (10/7/2011)


    Thanks, this is what I needed.

    I'm not so sure that's true. Depending on what the stored procedure actually does, it may be VERY beneficial to performance and resource...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: How to diplomatically not answer recruter's question about salary ?

    SQL Guy 1 (10/7/2011)


    Hi all,

    Perhaps all of you from time to time encountered a problem, when a recruting agent asks you about your current salary, but you don't want...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: String to rows

    ghanshyam.kundu (10/7/2011)


    thanks carolyn, its really a nice solution i use to do it via UDF.

    i think in term of performance also this one is better.

    thanks

    ghanshyam

    But, it's not. Please...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: String to rows

    Jason-299789 (10/7/2011)


    The code sample in this link should help. http://www.codeproject.com/KB/database/splitparameterstring.aspx

    The only difference is that instead of using a comma seperated list you use a # delimiter.

    One minor tweak could...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: String to rows

    Carolyn Richardson (10/7/2011)


    Try:

    DECLARE @xml xml, @v-2 nvarchar(max)

    SELECT @v-2 = N'A # B # C'

    SET @xml = N'<root><r>' + replace(@v,'#','</r><r>') + '</r></root>'

    SELECT

    replace(a.value('.','varchar(2)'),' ','') AS [RowName]

    FROM @xml.nodes('//root/r') AS a(a)

    Hi...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: String to rows

    Iulian -207023 (10/7/2011)


    Thank you so much to all of you

    I think I will try both methods

    the xml method to parse the file into lines and push to a table

    then...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: String to rows

    yubo1 (10/8/2011)


    create table test

    (

    string varchar(max)

    )

    insert into test

    select 'A#B#C'

    select SUBSTRING(string+'#',number,charindex('#',string+'#',number)-number) from

    test,

    (select number from master..spt_values where number>=1 and type='P')t

    where SUBSTRING('#'+string,number,1)='#'

    Yubo1,

    That method is the "old" method of splitting that uses concatenated delimiters. ...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: SQL-Server 2005: Change Ordinal Column Position

    Lynn Pettis (10/7/2011)


    ...(using a ref cursor in Oracle).

    GAH!!! MY EYES! MY EYES!!! NO MORE, PLEASE!!!

    😛

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: SQL-Server 2005: Change Ordinal Column Position

    Sean Lange (10/7/2011)


    Man it is hard to believe there still 3rd party things that are that short sighted. Sad actually.

    It's not a fault... it's a feature! 😀 Keeps people...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: Query to combine two fields into one output

    I don't believe that anyone has written about the performance penalty of using VARCHAR(MAX) and I haven't made a specific test for it. My statement comes from when I...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: Best approach to import text file?

    WaitingWonder2 (10/3/2011)


    Here is the table:

    IF OBJECT_ID('tBufOMIM') IS NULL

    BEGIN

    CREATE TABLE tBufOMIM (

    NOINT NOT NULL PRIMARY KEY,

    TIVARCHAR(MAX)NULL,

    TXVARCHAR(MAX)NULL,

    SAVARCHAR(MAX)NULL,

    CSVARCHAR(MAX)NULL,

    CNVARCHAR(MAX)NULL,

    RFVARCHAR(MAX)NULL,

    CDVARCHAR(MAX)NULL,

    EDVARCHAR(MAX)NULL,

    MNVARCHAR(MAX)NULL,

    AVVARCHAR(MAX)NULL

    )

    PRINT 'Table tBufOMIM was created'

    END

    GO

    Format file:

    <BCPFORMAT xmlns="http://schemas.microsoft.com/sqlserver/2004/bulkload/format" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <RECORD>

    <FIELD ID="1" xsi:type="CharTerm" TERMINATOR="*RECORD**FIELD* NO"/>

    ...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 15 posts - 32,356 through 32,370 (of 59,099 total)