Forum Replies Created

Viewing 15 posts - 3,931 through 3,945 (of 4,085 total)

  • RE: Increment 1 min when matching start and end time

    ColdCoffee (8/10/2010)


    INNER JOIN will fail with the following sample data :

    A CROSS JOIN with a WHERE clause that references both tables is essentially the same as an INNER JOIN.

    Please correct...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: updating xls from sql server

    Have you considered writing an SSRS report? You can use a table to get the datasheet and a matrix to get the pivot table. You can the schedule...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Number of trimesters between two dates

    I'm comparing the difference in months between the zero date and each date, dividing that by four (using integer division) and then subtracting the two values.

    DateDiff(Month, 0, FirstDateField)/4 - DateDiff(Month,...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Increment 1 min when matching start and end time

    ColdCoffee (8/10/2010)


    If you dont have an ID column, then as Lutz suggested, use ROW_NUMBER as given below.

    declare @tab table

    (

    rid int identity(1,1),

    starttime datetime,

    endtime datetime

    )

    insert...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Update time from a datetime column, using another datetime column.

    Rob Schripsema (8/9/2010)


    Assumptions:

    The date field has 00:00:00 for the time, and the time field contains spurious dates (maybe the date the value was entered? or are they all '1-1-1900',...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Procedure to select and insert

    You haven't given enough information. Check the following link on how to help people answer your question.

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

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: generate insert statements with data

    Jeff Moden (8/8/2010)


    drew.allen (8/7/2010)


    Here's an example using the Information_Schema.Tables view. WARNING: XML is case sensitive

    Thanks, Drew. Rumor has it that it's also pretty touchy about special characters like...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: update

    Tara-1044200 (8/6/2010)


    I see the problem now, there is no check for already updated rows in the loop and so it is an indefinite loop.

    so how would i check the updated...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Incorrect Syntax Keyword 'With'

    When creating dynamic SQL, it's a good idea to use the Quotename() function to appropriately quote table names, field names, et al. Quotename will automatically handle escaping the quote...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: generate insert statements with data

    I've actually started using the FOR XML clause to create the data and then using sp_xml_preparedocument and OPENXML() to read the data. Here are some of the reasons that...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: select with subquery in select clause

    If you want to improve your chances of getting help, you really should post the DDL statements to create your tables and the DML statements to insert sample data into...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Rolling 3 Weeks

    Jeff Moden (8/5/2010)


    drew.allen (8/4/2010)


    Even though dates are stored as real numbers, you really should be using DateAdd().

    Drew

    Whether I agree with such claims or not, such claims should be accompanied by...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Rolling 3 Weeks

    Eugene Elutin (8/4/2010)


    Try:

    declare @ReqDate datetime

    set @ReqDate = '20100806' --GETDATE()

    select LF-(7*wn)-(6) BeginDate, LF-(7*wn) EndDate, LF-(7*wn) PeriodEndingDate

    from

    (SELECT dateadd(dd, (DATEDIFF(dd,'1900-01-01',@ReqDate - 4) % 7 ) * -1,...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Extracting data into Table using OpenXML

    The problem is that you are using absolute paths rather than relative paths.SELECT *

    FROM OPENXML( @i, '/Return/SOURCE/DEST/MAPPING/MAP',2)

    WITH (

    Entity VARCHAR(10) '@ENTITY',

    MapId VARCHAR(10) '@MAP_ID',

    Form VARCHAR(10) '@FORM',

    Field VARCHAR(10) '@FIELD',

    Page VARCHAR(1000) '@PAGE',

    DDMType VARCHAR(10) '@DDM_TYPE',

    OverrideMessage...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Can I use pivot on this query?

    It might also help to give an overview of what the tables represent and what you are trying to accomplish.

    I also notice that you are joining the CASEEVENT table a...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 15 posts - 3,931 through 3,945 (of 4,085 total)