Forum Replies Created

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

  • RE: read/parse an XML field

    You can also filter in your XPath expression. For example:

    SELECT

    b.header.value('Value[1]', 'varchar(20)') AS Typex2

    FROM @bb.nodes('//ProcessTraceNode[contains(FunctionSymbol[1],"SUBFORMULA")]') AS b(header)

    I'm not sure which is more efficient.

    Drew

  • RE: Delete Rows

    If you group on the driver ID, you can find the Min() of the status. You can also use a PIVOT if the group by won't work for some...

  • 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...

  • 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...

  • 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,...

  • 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...

  • 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',...

  • 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

  • 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...

  • 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...

  • 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...

  • 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...

  • 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...

  • 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...

  • 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,...

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