Forum Replies Created

Viewing 15 posts - 766 through 780 (of 2,007 total)

  • RE: query for consecutive alphabets

    Jeff Moden (4/4/2012)


    Craig,

    Does your Tally table have a clustered index on it? If not, that may explain the results you got.

    Yep, clustered index with fill factor 100.

    It's...

  • RE: Trimming Data From A Record

    aitchkcandoo (4/3/2012)


    Lynn, thanks. That's helpful. Because those values are taken from a controlled vocabulary (drop down list), I am sure that the case will always be all upper-case etc....

  • RE: query for consecutive alphabets

    Jeff Moden (4/3/2012)


    Ohhhhh, be careful, Craig. You have absolutely the right idea but you've applied it "backwards". If you look at the actual execution plan, you're splitting the...

  • RE: Query for Dependencies

    --Fixed you sample data

    SELECT [OBJECT],DEPENDENCY

    INTO TABLE1

    FROM (VALUES

    ('VIEW1','TABLE1'),

    ('VIEW2','TABLE2'),

    ('VIEW3','VIEW2'),

    ('VIEW4','VIEW3'),

    ('VIEW5','TABLE1'),

    ('VIEW3','VIEW1'),

    ('VIEW5','VIEW4'))a([OBJECT],DEPENDENCY);

    --Best guess at what you want

    WITH CTE AS (SELECT a.DEPENDENCY, a.[OBJECT], ISNULL([ORDER],0) AS [ORDER]

    ...

  • RE: Outer Join with Aggregate problem

    Qutip (4/3/2012)


    Hi All,

    I've been banging my head against a brick wall trying to figure out why?!

    I have a table of Stores, a table of Transactions, transaction details and a Table...

  • RE: I'm Sure its Something Simple! Returning Different Companies Based on Parameter

    I may be oversimplifying what you've said but. . .

    You said. . .

    Andy Hyslop (4/3/2012)


    every row where CompanyA = 1 and CompanyB = 1 & 3 and where the SourceCompany...

  • RE: query for consecutive alphabets

    S_Kumar_S (4/3/2012)


    Hi

    I need a query(or function) that filter the names(column name) which have consecutive 3 alphabets. basically I want to filter out those garbage names. e.g. sabcmm has abc consecutive.So...

  • RE: Query Help

    suresh0534 (4/2/2012)


    How to Create a stored procedure to find the following output.

    [Q1 = Jan + Feb + Mar ][ Q3 = July + Aug + Sept]

    I need to calculate the...

  • RE: SQL Bits X...

    Unfortunately, I wasn't able to convince my company to send me to the paid days - probably because I've worked here less than a year. Will have to catch up...

  • RE: SQL Bits X...

    Yep, I'm here. Sat at the front waiting for Adam Machanic's talk. Should be fun 🙂

  • RE: Return records with Max Sequence Number

    3,000 visits and you haven't learnt that the best way to get answers to your questions is to provide consumable sample data rather than a non-consumable table?

    SELECT Company, Category,...

  • RE: Put data on the same column

    EjSQLme (3/29/2012)


    Anyone with any idea on this?

    If it is always no more than 4, then this will work: -

    SELECT PersonID, workedcode, CONVERT(VARCHAR(10), eventdate, 101) AS Eventdate,

    MAX(CASE WHEN rn = 1...

  • RE: Vertical to Horizontal

    imrankhan777 (3/29/2012)


    WITH CTE AS (

    SELECT DISTINCT Store, PhoneNr,

    ROW_NUMBER() OVER(PARTITION BY Store ORDER BY PhoneNr) AS Items

    FROM ##testEnvironment)

    SELECT Store,(SELECT PhoneNr FROM CTE AS C...

  • RE: Vertical to Horizontal

    Always like to test when there are multiple ways to perform a task.

    So, lets build some sample data.

    IF object_id('tempdb..#testEnvironment') IS NOT NULL

    BEGIN

    DROP TABLE #testEnvironment;

    END;

    SET NOCOUNT ON;

    --999,999...

  • RE: Rules Table

    Seems a bit of an over complication to me.

    --Sample data

    DECLARE @orders TABLE (OrderID INT IDENTITY(1,1) PRIMARY KEY, OrderAmt MONEY);

    INSERT INTO @orders

    SELECT OrderAmt

    FROM (VALUES(45),(56.60),(75.00),(101.00))a(OrderAmt);

    --Query

    SELECT OrderID, OrderAmt, fee, OrderAmt + fee AS...

Viewing 15 posts - 766 through 780 (of 2,007 total)