Forum Replies Created

Viewing 15 posts - 33,256 through 33,270 (of 59,102 total)

  • RE: How to add "dot" after every three digits in a number in sql 2005

    barsuk (7/18/2011)


    Declare @FileName varchar (100)

    Set @FileName ='12304208348300'

    SELECT REPLACE(Left(Convert(Varchar,Convert(Money,@FileName),1),Len(Convert(Varchar,Convert(Money,@FileName),1)) - 3),',','.')

    12.304.208.348.300

    Not sure what the problem was?

    I know that this code has limitations, but for the values specified earlier in the thread...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: Are the posted questions getting worse?

    GilaMonster (7/18/2011)


    Jeff Moden (7/17/2011)


    Ummm... isn't MCM only two weeks long?

    The MCM is 2 exams, no training component. The chance of passing without finding some suitable training however....

    Wasn't there...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: How to add "dot" after every three digits in a number in sql 2005

    Tim O'Brien-386385 (7/13/2011)


    By far the easiest...convert to money, format, strip decimal point:

    Print Reverse(SubString(Reverse(Convert(varchar,Convert(Money,1234567891011),1)),4,99))

    Prints 1,234,567,891,011

    That will also likely be one of the slowest methods. "Reverse" is a very expensive function....

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: How to add "dot" after every three digits in a number in sql 2005

    obarahmeh (10/20/2008)


    I think that the best solution is added by krayknot.

    Thanks to all...

    Absolutely not. There's no need for the RBAR of that code.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: Table Without a Primary key?

    Subrata Bauri (7/15/2011)


    Jayanth_Kurup (7/15/2011)


    Enforcing primary key on a table is purely a design decision , while sql doesn't force it; it allows suitable substitutes in columns such as identity columns...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: hi

    sonwane.pratibha (7/18/2011)


    high normalize or less normalize what will u put on ur database design in sql server ?

    "It Depends"... is it a "real" database, a "reporting database", or a "data...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: Naming Conventions

    It's just me, I know, but I name my tables after what a single row of any given table contains. Part of the reason is...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: loops

    kritika (7/18/2011)


    USE tempdb

    GO

    Declare @TotalRows int, @minRow int

    CREATE TABLE #Temp

    ( Id int identity(1,1),

    Queue_stub uniqueidentifier

    )

    INSERT INTO #temp

    SELECT Queue_Stub

    FROM <table_name> WHERE condition

    SET @TotalRows=@@Rowcount

    SET @minRow=1

    --Using loops

    DECLARE @queue_stub uniqueidentifier

    SET @queue_stub = ''

    WHILE @minRow...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: loops

    Perry Whittle (7/18/2011)


    Jeff Moden (7/17/2011)


    It'll take me a couple of hours but...one lesson in "set based" thinking coming right up.

    looking forward to that already Jeff

    Jeff Moden (7/17/2011)


    Now... where...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: need help with the code

    Hardy21 (7/17/2011)


    sql2k8 (7/15/2011)


    the below code also works

    code please..

    It's a "newbie" forum mistake. His first post where the OP said "Thank You very much. Your code works " was in...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: How to get count for week range?

    thundersplash845 (7/17/2011)


    Lutz,Thanks for your reply.. But how do i get the count of records per week??

    I want something like the below one...How do i include in my code to get...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: Are the posted questions getting worse?

    Craig Farrell (7/17/2011)


    Do you honestly think in 8 hours of training you can get a from scratch IT employee to a working (Junior) DBA?

    No... of course not. But I...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: Are the posted questions getting worse?

    Jim Murphy (7/17/2011)


    Jeff Moden (7/17/2011)


    Don't get me wrong... I'm not pushing MS certs. 😉 That's been tried before and failed.

    Jeff - what's been tried and failed:

    A) 2 week death...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: Are the posted questions getting worse?

    Craig Farrell (7/17/2011)


    Jeff Moden (7/16/2011)


    WayneS (7/15/2011)


    Lynn Pettis (7/15/2011)


    Chad Crawford (7/15/2011)


    Craig Farrell (7/14/2011)


    Hey guys, does anyone know of boot camp training session(s) for SQL Server for practical skills (not certifications)....

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • RE: Are the posted questions getting worse?

    Fal (7/17/2011)


    The Dixie Flatline (7/15/2011)

    If someone comes around [a] place of work with a baseball bat and says "Nice little database server you got here... be a shame if something...

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 15 posts - 33,256 through 33,270 (of 59,102 total)