Forum Replies Created

Viewing 15 posts - 511 through 525 (of 2,007 total)

  • RE: Help with a query - self join on table

    Hey,

    could you read this article[/url], then set-up the DDL and sample data in this format please? Then include the expected results based on your sample data.

    Thanks 😀

  • RE: missing index script?

    I generally use this query as a first step in determining missing indexes.

    DECLARE @DBName VARCHAR(50) = 'yourDB';

    SELECT [Total Cost] = ROUND(avg_total_user_cost * avg_user_impact * (user_seeks + user_scans), 0),

    avg_user_impact, TableName...

  • RE: CROSSTAB Without aggregates (SUM, AVG, Etc)

    jdnelson.web (8/24/2012)


    You are both genii. Thank you very much. A couple of questions which I can assume will be easy for you to answer.

    1. How would...

  • RE: How to do this? Part-2

    ganeshkumar005 (8/24/2012)


    I have a table A:

    StudIDRollNo

    AlphaD1234

    betaA1122

    charlieD1234

    bravoC1342

    tomB1964

    harryA1122

    and table B:

    RollNoSubjectCode

    D12341001

    A11224001

    D12342001

    C13425001

    B19646001

    A11223001

    I want to join the table A and B. For studID Alpha from table A i want the subjectcode 1001 only from table...

  • RE: CROSSTAB Without aggregates (SUM, AVG, Etc)

    --== CREATE SAMPLE DATA (your should've included this in your post) ==--

    -- Note, because you have written your "date" in the format you have, I've assumed

    -- it is a VARCHAR...

  • RE: Cannot get Left JOIN to work correctly

    tshad (8/23/2012)


    Actually, it isn't exactly the same way.

    I was trying to figure out how to get your way to work with a middle table and couldn't get it to work.

    You're...

  • RE: Cannot get Left JOIN to work correctly

    The same way we've already explained.

    SELECT *

    FROM (SELECT DealerID, DealerCode, DealerName, ForecastId, Name

    FROM Dealers d

    CROSS JOIN Forecast f)...

  • RE: T-SQL String manipulation - 2(Reading numeric values from String appended by '.')

    Phil Parkin (8/22/2012)


    Maybe I jumped to the wrong conclusion - I didn't spend much time considering the question itself. I just liked the fact that you had used fairly advanced...

  • RE: T-SQL String Manipulation- Need help

    ChrisM@Work (8/22/2012)


    SELECT

    Stringy,

    Stuffy = STUFF(STUFF(STUFF(Stringy,x3.startpos+1,x3.endpos-x3.startpos-1,'n'),x2.startpos+1,x2.endpos-x2.startpos-1,'n'),x1.startpos+1,x1.endpos-x1.startpos-1,'n')

    FROM (SELECT Stringy = 'A1(1).B22(10).C345(100)') d

    CROSS APPLY (SELECT startpos = CHARINDEX('(',Stringy,1), endpos = CHARINDEX(').',Stringy+'.',1)) x1

    CROSS APPLY (SELECT startpos = CHARINDEX('(',Stringy,x1.startpos+1), endpos = CHARINDEX(').',Stringy+'.',x1.endpos+1)) x2

    CROSS APPLY...

  • RE: T-SQL String Manipulation- Need help

    DECLARE @str VARCHAR(256) = 'A1(1).B22(10).C345(100)';

    WITH CTE(N) AS (SELECT 1 UNION ALL SELECT 1),

    CTE2(N) AS (SELECT 1 FROM CTE x, CTE y),

    CTE3(N) AS (SELECT 1 FROM CTE2 x, CTE2 y),

    CTE4(N) AS...

  • RE: T-SQL String manipulation - 2(Reading numeric values from String appended by '.')

    Phil Parkin (8/22/2012)


    Is this homework? Interview questions? Because getting someone else to provide you with a solution is unlikely to help you learn.

    Especially not that solution! :w00t:

    Whoops? 😉

  • RE: T-SQL String Manipulation- Need help

    ssskumar4u (8/22/2012)


    Hi Cadavre,

    Thanks for your great help.

    I observed that for this input :

    @str = 'A1(1).B2(2)'

    output from your code : Ann).Bnn)

    Desired output : A1(n).B2(n)

    String manipulation shoud effect only the numbers...

  • RE: T-SQL String manipulation - 2(Reading numeric values from String appended by '.')

    ssskumar4u (8/22/2012)


    Hi,

    I have to peform a string manipulation as below:

    Input: A(1).B(23).C(456)

    Expected output : 1.23.456 ( need to append '.' for each substring)

    Current output with below code : ...

  • RE: T-SQL String Manipulation- Need help

    Different approach: -

    DECLARE @str VARCHAR(256);

    SET @str = 'A(1).BC(10).DEF(100)';

    WITH CTE(N) AS (SELECT 1 UNION ALL SELECT 1),

    CTE2(N) AS (SELECT 1 FROM CTE x, CTE y),

    CTE3(N) AS (SELECT 1 FROM CTE2 x,...

  • RE: how to find gap ranges in range based entry.

    rajemessage (8/22/2012)


    please take on sample of data.

    Entry can be done in from lenght and to lenght like following.

    900000.0001,900000.0005 so there is gap of .0004.

    starting from .0001 to .0005...

Viewing 15 posts - 511 through 525 (of 2,007 total)