Forum Replies Created

Viewing 15 posts - 1,291 through 1,305 (of 2,645 total)

  • Reply To: Extract Blocks of Number

    Alan Burstein wrote:

    Grab a copy of NGrams8k and you can do this:

    Declare @Temp Table(SomeId INT IDENTITY, [Data] VarChar(8000))

    Insert @Temp ([Data])
    Values('hello my name is john 07999999999 smith 07888888888 this...
  • Reply To: Extract Blocks of Number

    dramaqueen wrote:

    Hi,

    There is a maximum of three occurrences.

    I want the output to be the numbers separated by a comma.

    07999999999, 07888888888

    Thanks,

    Paul

    Once you have the numbers in separate rows you can make...

  • Reply To: Query tuning of SELECT

    I'm assuming that rows are added roughly in CREATE_DATE order. That means you will find the earliest rows on db1 very quickly as no rows have been deleted.

    On db2 you...

  • Reply To: Extract Blocks of Number

    A recursive CTE will allow you to select more than one number from a line

    DROP TABLE #t1
    go

    CREATE TABLE #t1
    (
    SomeText VARCHAR(500)
    );

    INSERT #t1
    (
    ...

    • This reply was modified 5 years, 10 months ago by Jonathan AC Roberts. Reason: Changed PATINDEX('%[^0-9]07[^0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][^0-9]%', ' ' + t.SomeText+' ')
  • Reply To: Query tuning of SELECT

    How long does it take to do the select on just a small not null column with the same query on both databases? e.g.:

    select TOP (50000) CREATE_DATE
    from...
  • Reply To: Running Totals by Date and Account

    I didn't mess with any indexes on the table you provided.

    Here are a few methods:

    Update Windowed SUM/COUNT using ROWS BETWEEN

    /*-- ****************************************************************************************
    -- Update Windowed SUM/COUNT using ROWS BETWEEN
    --...
  • Reply To: Running Totals by Date and Account

    Jeff Moden wrote:

    Jonathan AC Roberts wrote:

    Jeff Moden wrote:

    I do have a way to avoid that problem that will blow the doors off of most other methods for calculating running totals but it does take...

  • Reply To: Running Totals by Date and Account

    Jeff Moden wrote:

    I do have a way to avoid that problem that will blow the doors off of most other methods for calculating running totals but it does take a bit...

  • Reply To: Need help with a Query

    DesNorton wrote:

    This is a classic Catch-All query.

      <li style="list-style-type: none;">

    • If you check your execution plan, you will note that you have all table/index scans and no seeks.  That is...
  • Reply To: Need help with a Query

    I'm not sure what the parameter values mean, but I think you might have meant to check if the parameter is null not the column?

    SELECT *
    ...
  • Reply To: Running Totals by Date and Account

    drew.allen wrote:

    Jonathan AC Roberts wrote:

    SELECT Date,
    SUM([101]) OVER (ORDER BY Date) Acct#1,
    SUM([201]) OVER (ORDER BY Date)...
  • Reply To: Running Totals by Date and Account

    I'm not sure if the OVER clause is available in SQL 2008, if it isn't you can use this method:

    SELECT a.Date,
    ...
  • Reply To: Running Totals by Date and Account

    SELECT Date,
    SUM([101]) OVER (ORDER BY Date) Acct#1,
    SUM([201]) OVER (ORDER BY Date) Acct#2,
    ...
  • Reply To: Update - W. Average Query

    SQL Server wrote:

    Don't know how come I missed that. The BWAvg will be NULL when the data is inserted and will be updated later.

    insert into tblData3 Values ('4567','ABC',NULL)
    insert...
  • Reply To: Update - W. Average Query

    It would be helpful if you could show what results are expected.

    There is no data in tblData3 so I don't see how you can do an update?

Viewing 15 posts - 1,291 through 1,305 (of 2,645 total)