Forum Replies Created

Viewing 15 posts - 3,586 through 3,600 (of 4,087 total)

  • RE: Trying to avoid RBAR

    Kenneth Fisher-475792 (10/3/2011)


    drew.allen (9/30/2011)


    Kenneth Fisher-475792 (9/30/2011)


    I'm looking for a query to take the following table

    This is a report and you should be using a reporting tool to generate it. ...

  • RE: How to find the nth record based on specific condition

    Prasanthi Reddy (10/2/2011)


    Hi,

    I have a table which contains on and off status of a meter. Feederstatus = 0 means On and feederstatus=1 means Off.

    You do realize that this is exactly...

  • RE: Trying to avoid RBAR

    Kenneth Fisher-475792 (9/30/2011)


    I'm looking for a query to take the following table

    This is a report and you should be using a reporting tool to generate it. T-SQL is not...

  • RE: Need advice on Logging XML

    R.P.Rozema (9/30/2011)


    Can't you generate the xml, then read it to find the orders in there for the audit? If it's an audit you want to be sure the xml generation...

  • RE: Index/Stats Maintenance execution

    If you use FOR XML PATH('') to create your SQL command string, it will create a single string rather than one per index, so you don't even need the loop....

  • RE: Need advice on Logging XML

    If I were doing this, I would probably just store the XML document in your audit table. That way you have a record of EXACTLY what was sent to...

  • RE: ROW_NUMBER() OVER (PARTITION BY *** ORDER BY ***) excluding NULL values

    The problem with a UNION (ALL) is that you will have to scan the table twice. Here is an approach that only scans the table once.

    SELECT [ID]

    ...

  • RE: Syntax problem: WITH XMLNAMESPACES in subquery

    Variables can be set using either a SET statement or a SELECT statement. You need to use the SELECT statement version

    declare @xml XML='';

    declare @ChildPrtID nvarchar(100) = 'T12345';

    ;with XMLNAMESPACES ('http://swp.converteam.com'...

  • RE: Unexpected results; SELECT statement with IN and NOT IN

    It's the same as any other correlated subquery. The processor first checks for the field in the scope of the subquery. If it can't find the field there,...

  • RE: Compare varchar to decimal

    It's because you're doing a string comparison. For example, since the character '4' comes after the character '2', any string that begins with a '4' is greater than any...

  • RE: Else part of If Else statement doesn't work

    Sean Lange (9/28/2011)


    I will reformat this in c style blocking so you can see what was happening with the structure the way you had it.

    Since you didn't include your code...

  • RE: Find first day of a week/month

    Kingston Dhasian (9/28/2011)


    This should work for you then..

    DECLARE @from_date DATETIME

    SET @from_date = '11-Sep-2011'

    SELECT CASE

    WHEN DATEADD( MONTH, DATEDIFF(...

  • RE: Find first day of a week/month

    SQLRNNR (9/28/2011)


    It appears there is an issue with how SQL handles dates that land on Sunday.

    Actually the problem lies with this piece of code:

    DATEADD(wk, DATEDIFF(wk, 0, GetDate()), 0)

    Similar code works...

  • RE: Generating add or delete transactions

    I think that this will give you want you need without depending on having a complete history of the transactions.

    ;

    WITH Items AS (

    SELECT ItemID

    , EndDate

    , Row_Number() OVER( PARTITION BY ItemID...

  • RE: I'm stumped on a concatenation problem

    The only thing that I would suggest is that since AccumID is already character data, it doesn't make sense to (implicitly) convert it to an integer and then (explicitly) convert...

Viewing 15 posts - 3,586 through 3,600 (of 4,087 total)