Forum Replies Created

Viewing 15 posts - 391 through 405 (of 444 total)

  • RE: How to remove duplicate records in this situation.

    ...within 30 days from what ?

    Pls try restate the problem it terms like "To incude this row in a result set there must [not] exsist rows such that..."

    Particulary, what...

  • RE: XML File Encoding before insert into XML Column

    OK.

    But when file is converted to NVARCHAR, you may live with CHAR(160) as well.

    select col.value('myData[1]/@myAttr', 'nvarchar(50)')

    from

    (select CAST(N'<myData myAttr="12'+char(160)+ N'34" />' as XML)) as...

  • RE: XML File Encoding before insert into XML Column

    Which way have you figured out the symbol in error? Note in the message type of

    XML parsing: line 1, character 77, illegal xml character

    reported position is the position in the...

  • RE: Help needed in Date Logic

    Note today is 1st of October.

    If you need data as it's still September, set @now as needed.

  • RE: concatenate with leading zeros

    More Integer Math less RIGHT 🙂

    PRINT '========== Integer Math RIGHT(RIGHT) Method =========='

    SET STATISTICS TIME ON;

    SELECT @Bitbucket = RIGHT('000000000'+RIGHT(C1*1000+C2,9),9)

    FROM #TestTable;

    SET STATISTICS TIME OFF;

    ...

  • RE: Help needed in Date Logic

    Then just reverse join order. You may also need to ajust BETWEEN to exact month's first / last days as you do it in your original query. See below

    SELECT

    ...

  • RE: How Many Different Random Numbers?

    happycat59 (9/29/2014)


    With the SELECT statement as it stands, you get a different result depending on, for instance, which database you run it in.

    +1

  • RE: Assign next aviliable column values

    Plain CASE will help

    create table #StuDetails(City varchar(25),StuStatus varchar(25), currentValue int,Week1 int,week2 int,week3 int,week4 int)

    insert into #StuDetails values('A','new',13,10,0,0,12)

    insert into #StuDetails values('B','Old',10,10,41,0,12)

    insert into #StuDetails values('C','Fail',10,9,0,0,5)

    SELECT City, StuStatus, currentValue

    ,Week1 = CASE week1...

  • RE: Previous Max Event

    Gagandeep Singh (9/27/2014)

    2Change11/10/2014 1:012/3/2013 2:04

    Really Start > End is OK? Explain please.

    Try this quey to enumerate all intervals, including open ones. Restriction: no 'On's after 'On' or 'Off's...

  • RE: Hourly

    Is'n it the expressions you need?

    select

    timeStart = dateadd(hh, datediff(hh, 0, getdate()) , 0)

    ,timeEnd = dateadd(hh, datediff(hh, 0, getdate()) + 1, 0)

  • RE: Hourly

    If rounded interval is needed

    SELECT

    timeStart =

    DATEADD(MINUTE

    ,-DATEPART(MINUTE,getdate())

    ,DATEADD(SECOND

    ,-DATEPART(SECOND,getdate())

    , DATEADD(MS,

    -DATEPART(ms,getdate())

    ,getdate())))

    ,timeEnd =

    DATEADD(MINUTE

    ,-DATEPART(MINUTE,getdate()) + 60

    ,DATEADD(SECOND

    ,-DATEPART(SECOND,getdate())

    , DATEADD(MS,

    -DATEPART(ms,getdate()) - 1

    ,getdate())));...

  • RE: SQL SERVER Comma Separated values XML PATH

    The split function you cited returns table of VARCHAR(8000) because this is what Item = SUBSTRING(@pString, l.N1, l.L1) returns due to it's first argument type. Provided Call_Detail_Report_Repository.NodeTraversed is...

  • RE: count of rows.

    For example, above DVM will count rows inserted by uncommited transactions. SQL Server 2008.

    Open two queries in Managment Studio. In first query run

    CREATE TABLE [testDVM](

    [a] [int] NULL

    ) ON [PRIMARY]

    GO

    BEGIN TRAN;

    INSERT...

  • RE: count of rows.

    Note DM view do not take care of transactions. SELECT COUNT(*) and DM may return different number of rows.

  • RE: compare the next row with the previous row of same table

    Eirikur Eiriksson (9/22/2014)

    When using an identity property to maintain the sequence, re-inserting would simply imply an identity insert. On the other hand, temporal sequence would be both more robust and...

Viewing 15 posts - 391 through 405 (of 444 total)