Getting Started with Adobe After Effects - Part 6: Motion Blur
First Time? You can support us by signing up. It takes only 5 seconds. Click here to sign up. If you already have an account, click here to login.

TSQL Challenge 46 - Remove leading characters from string

78   Comments   

Unsubscribe from Notifications
  • What does it mean "ascending order based on the numeric value of the string"?

    The order of the rows in the original table?

    Alphabetical case sensitive order of String column?

    commented on Dec 27 2010 3:37AM  .  Report Abuse This post is not formatted correctly
    Geri Reshef
    139 · 1% · 354
  • One way to look at it is as follows:
    'A' is equal to the number x41.
    'B' is equal to the number x42. x42 is bigger than x41 thus 'B' comes after 'A'.
    'AB' is equal to x4142. As a number, that's bigger that x41 or x42. Thus 'AB' comes after 'A' and 'B' in the sort order.
    This is the principle you need to apply.

    commented on Dec 27 2010 4:02AM  .  Report Abuse This post is not formatted correctly
    dishdy
    17 · 10% · 3262
  • Even though this may look like a simple challenge, let's try this simple performance test. I'm going to use Stefan's approach of using a single row of data which, in challenge 41, really intreagued me.

    Query:

    if object_id('tc46') is not null drop table tc46
    go
    create table tc46 (String varchar(max))
    go
    insert into tc46 select replicate(convert(varchar(max),'a'),1000000)+'b'
    go
    select *,LEN(String) l from tc46
    

    The Results-column should naturally show just 'b'.

    Here are my statistics:

    (1 row(s) affected)
    Table 'tc46'. Scan count 1, logical reads 1, physical reads 0, read-ahead reads 0, lob logical reads 1238, lob physical reads 0, lob read-ahead reads 428. Table 'Worktable'. Scan count 0, logical reads 7, physical reads 0, read-ahead reads 0, lob logical reads 888849, lob physical reads 0, lob read-ahead reads 122.
    SQL Server Execution Times:
    CPU time = 3109 ms, elapsed time = 3265 ms.

    commented on Dec 27 2010 2:55PM  .  Report Abuse This post is not formatted correctly
    dishdy
    17 · 10% · 3262
  • OK, with a slight tweak I got this down to:

    (1 row(s) affected)
    Table 'tc46'. Scan count 1, logical reads 1, physical reads 0, read-ahead reads 0, lob logical reads 1240, lob physical reads 0, lob read-ahead reads 489.
    Table 'Worktable'. Scan count 0, logical reads 13, physical reads 0, read-ahead reads 0, lob logical reads 117582, lob physical reads 0, lob read-ahead reads 366.
     SQL Server Execution Times:
       CPU time = 453 ms,  elapsed time = 562 ms.

    commented on Dec 27 2010 3:23PM  .  Report Abuse This post is not formatted correctly
    dishdy
    17 · 10% · 3262
  • Should it be ordered on the String or on the Result ?

    commented on Dec 27 2010 5:48PM  .  Report Abuse This post is not formatted correctly
    Bert
    57 · 3% · 1038
  • I think the expected results in the challenge description shows clearly on which column to order: the String.

    commented on Dec 28 2010 1:34AM  .  Report Abuse This post is not formatted correctly
    dishdy
    17 · 10% · 3262
  • @dishdy

    The Results-column should naturally show just 'ab'.

    Are you sure?

    commented on Dec 28 2010 1:48AM  .  Report Abuse This post is not formatted correctly
    Leszek Gniadkowski
    8 · 18% · 5718
  • Can be in String chars with ascii codes <32 and >127 ?

    commented on Dec 28 2010 2:23AM  .  Report Abuse This post is not formatted correctly
    Leszek Gniadkowski
    8 · 18% · 5718
  • @Leszek Gniadkowski

    The Results-column should naturally show just 'ab'.[/quote] Are you sure?

    Ooops. Fixed it.
    Actually I was checking to see if everyone is awake .-)

    commented on Dec 28 2010 3:31AM  .  Report Abuse This post is not formatted correctly
    dishdy
    17 · 10% · 3262
  • @Leszek Gniadkowski

    Can be in String chars with ascii codes <32 and >127 ?

    ascci code>=32 and ascii code<=255

    commented on Dec 28 2010 4:02AM  .  Report Abuse This post is not formatted correctly
    dishdy
    17 · 10% · 3262
Previous 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 Next

Your Comment


Sign Up or Login to post a comment.

Managed Windows Shared Hosting by OrcsWeb

Copyright © Rivera Informatic Private Ltd.