Forum Replies Created

Viewing 15 posts - 91 through 105 (of 1,251 total)

  • Reply To: String extraction - SQL 2012

    DECLARE 
    @String VARCHAR(100) = 'CKflower2002-pouch-5AR-OneSize'
    select
    SUBSTRING(@string,PATINDEX('%[0-9]%',@string),PATINDEX('%[^0-9a-z]%',@string)-PATINDEX('%[0-9]%',@string))

    That will work for whatever the first delimiter is and for any length of string before the numbers.  It does assume that...

    • This reply was modified 6 years, 3 months ago by Neil Burton.
    • This reply was modified 6 years, 3 months ago by Neil Burton.


    On two occasions I have been asked, "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" ... I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
    —Charles Babbage, Passages from the Life of a Philosopher

    How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537

  • Reply To: String extraction - SQL 2012

    select REPLACE(REPLACE(SUBSTRING('CKnovelty2002_pouch-5AR-OneSize',1,CHARINDEX('_','CKnovelty2002_pouch-5AR-OneSize',1) - 1),'CKnovelty',''),'CKflower','')

    Your CHARINDEX was looking for '-' rather than '_'.


    On two occasions I have been asked, "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" ... I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
    —Charles Babbage, Passages from the Life of a Philosopher

    How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537

  • Reply To: Are the posted questions getting worse?

    Lynn Pettis wrote:

    Eirikur Eiriksson wrote:

    MVDBA (Mike Vessey) wrote:

    don't - I went once and it was "an experience" (this is from Wikipedia)

    Kæstur hákarl, fermented Greenland shark.

    Súrsaðir hrútspungar, the testicles of rams pressed in blocks, boiled...


    On two occasions I have been asked, "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" ... I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
    —Charles Babbage, Passages from the Life of a Philosopher

    How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537

  • Reply To: Are the posted questions getting worse?

    Steve Jones - SSC Editor wrote:

    Glad to see everyone is talking about SQL Server stuff. Hope you've had a good last month.

    The end of last month was fantastic because I had a week in...


    On two occasions I have been asked, "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" ... I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
    —Charles Babbage, Passages from the Life of a Philosopher

    How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537

  • Reply To: Error on executing rename statement

    You need to run

    EXEC sp_rename

    and remove the ''GO'.  That is a batch separator so your IF is technically in a different piece of code from your ELSE.


    On two occasions I have been asked, "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" ... I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
    —Charles Babbage, Passages from the Life of a Philosopher

    How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537

  • Reply To: tempdb shrinking

    If I remember rightly it's something to do with execution plans that use temp tables but don't take my word for that.


    On two occasions I have been asked, "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" ... I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
    —Charles Babbage, Passages from the Life of a Philosopher

    How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537

  • Reply To: tempdb shrinking

    This post helped me in a similar situation.  There might be a couple of other things you need to do but that was a good place to start.


    On two occasions I have been asked, "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" ... I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
    —Charles Babbage, Passages from the Life of a Philosopher

    How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537

  • Reply To: How to write loop below with best practice performance ?

    Sometimes a loop is the best way to do something.  Doing something iteratively can be one of those times.  Have you tested the performance of a loop? Do you know...


    On two occasions I have been asked, "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" ... I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
    —Charles Babbage, Passages from the Life of a Philosopher

    How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537

  • Reply To: Are the posted questions getting worse?

    Stopped gigging a while back, now it is only for my personal pleasure (read: when no one else is at home)

    Same here, it's one of the disadvantages to the 9-5...


    On two occasions I have been asked, "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" ... I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
    —Charles Babbage, Passages from the Life of a Philosopher

    How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537

  • Reply To: Are the posted questions getting worse?

    jonathan.crawford wrote:

    Jack's just kinda boring, that's all. It's not "bad", like undrinkable or anything, but it's not interesting either.

    Some of the special Jacks are much better.  I don't think they're...


    On two occasions I have been asked, "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" ... I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
    —Charles Babbage, Passages from the Life of a Philosopher

    How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537

  • Reply To: Are the posted questions getting worse?

    ChrisM@Work wrote:

    jasona.work wrote:

    OK, so I'm curious and interested in expanding my repertoire when it comes to liquor...

    Whiskey / whisky vs scotch, and, what's so bad about Jack D?

    (Note, I've only...


    On two occasions I have been asked, "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" ... I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
    —Charles Babbage, Passages from the Life of a Philosopher

    How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537

  • Reply To: Are the posted questions getting worse?

    Thom A wrote:

    Grant Fritchey wrote:

    Thom A wrote:

    Grant Fritchey wrote:

    Tonight, I'll be having haggis. Pray for me.

    Haggis is great though! Haven't had it in ages mind, but I've enjoyed it every time I have. In...


    On two occasions I have been asked, "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" ... I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
    —Charles Babbage, Passages from the Life of a Philosopher

    How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537

  • Reply To: Are the posted questions getting worse?

    MVDBA (Mike Vessey) wrote:

    haggis is great - it's the whiskey that makes it better

    Careful with that 'e' there Mike.  It's normally 'whisky' you have with haggis.


    On two occasions I have been asked, "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" ... I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
    —Charles Babbage, Passages from the Life of a Philosopher

    How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537

  • Reply To: Are the posted questions getting worse?

    I'm planning on doing another belly this summer when I do 2 pork shoulders and 6 chickens for my daughter's grad party.  She's undecided on the smoked macaroni and cheese. ...


    On two occasions I have been asked, "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" ... I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
    —Charles Babbage, Passages from the Life of a Philosopher

    How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537

  • Reply To: Are the posted questions getting worse?

    MVDBA (Mike Vessey) wrote:

    David Burrows wrote:

    Maybe I should post more :-/ Just never seem to have an answer or a better solution 🙁

    The one time I met Grant in person, we chatted about...


    On two occasions I have been asked, "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" ... I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
    —Charles Babbage, Passages from the Life of a Philosopher

    How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537

Viewing 15 posts - 91 through 105 (of 1,251 total)