Forum Replies Created

Viewing 15 posts - 2,686 through 2,700 (of 3,480 total)

  • RE: How to repeat the same row combination?

    Srinivasan,

    Here's the create table and insert scripts:

    CREATE TABLE MyData(

    CustomerID INT,

    MonthIDINT,

    RSCIDINT,

    Flag1BIT,

    Flag2BIT,

    Flag3BIT);

    GO

    INSERT INTO MyData(CustomerID, MonthID, RSCID, Flag1, Flag2, Flag3)

    VALUES(123,294,3456,0,0,0),

    (123, 300, 1234,0,1,1),

    (123,303, 3542,0,1,0),

    (123,303,2345,1,1,1),

    (123,304,3542,0,1,0),

    (123,304,2345,1,1,1),

    (123,305,3542,0,1,0),

    (123,305,2345,1,1,1),

    (123,306,2345,1,1,1),

    (123,306,3542,0,1,0),

    (123,307,2345,1,1,1),

    (123,307,3542,0,1,0),

    (123,308,3542,0,1,0),

    (123,309,3542,0,1,0);

    Could you give an example of your expected result?

  • RE: SQL DATABASE

    Without sample data, it's hard to see what you mean exactly. If you have a table of tasks or jobs, and then a child table of status updates, then...

  • RE: Horizontal Axis Order

    I'm not reporting on a cube, but if you use a number for the month (or better a date column) in your report instead of a string, SSRS will see...

  • RE: Horizontal Axis Month Sales

    You may need to force the existence of all dates in the range. (This would probably be better with a CTE to generate dates in a range, but anyway...)

    --...

  • RE: Add time

    =DATEADD("n",150,Fields!orderdate.Value)

    n = Minutes (because M is months)

    h = hours

    s = seconds

  • RE: How to sum and group data

    Since he's new, I did part of it... Here are the create table statements:

    -- seems there's a table missing. Parent of the other 4 tables.

    CREATE TABLE Customer (

    CustomerAcct CHAR(10)

    CONSTRAINT...

  • RE: Anyone tried "DBA Job Interview Question & Answer Kit"?

    I have not seen it, but I've watched some of his presentations. He knows his stuff, for sure. There aren't many SQL Server Masters, and he is one -...

  • RE: select columns from different tables without join

    I agree. Cool solution Eirikur... I just cheated on the ASCII part... and ROW_NUMBER() was a handy surrogate.

  • RE: select columns from different tables without join

    Why the "not using ROW_NUMBER()" restriction? It works!!

    Table scripts:

    CREATE TABLE A (num1 TINYINT PRIMARY KEY);

    GO

    INSERT INTO A(num1) VALUES (1),(2),(3),(4),(5);

    CREATE TABLE B(ltr CHAR PRIMARY KEY);

    GO

    INSERT INTO B(ltr) VALUES('a'),('b'),('c');

    SQL:

    SELECT num1, x.ltr...

  • RE: Missing Months in a GROUP BY statement

    Since you're new, we'll try to be gentle... no guarantees though. Help yourself by reading Jeff's article "Forum Etiquette: How to post data/code on a forum to get the...

  • RE: Missing Months in a GROUP BY statement

    To do what you want, you need a Calendar table with all the Months/Years you want, and then outer join that to your Invoices table.

    Something like...

    SELECT c.Year, c.MonthNumber, SUM(i.InvoiceAmount) AS...

  • RE: using charindex

    Try using DelimitedSplit8K.

    Read this article:http://www.sqlservercentral.com/articles/Tally+Table/72993/

    Folks here help people, they don't usually do their work for them. So show us what you tried...

  • RE: Convert Iterative query to set based query

    Your data is contradictory. A vehicle is moving whenever Speed>0, but your data says that it's not moving unless speed>1.

    If you have SQL Server 2012 or later this can...

  • RE: How to model a slowly changing dimension

    Yes to all three.

    The confusing part for me was how to compare a group of sales from one year to another year when the territory definitions are changing. (So that...

  • RE: How to model a slowly changing dimension

    Jeff,

    Oh, I think I get it now... So each time a customer got assigned to a different territory, then I would have to create a new record for that customer...

Viewing 15 posts - 2,686 through 2,700 (of 3,480 total)