Forum Replies Created

Viewing 15 posts - 25,591 through 25,605 (of 59,102 total)

  • RE: palindrome

    sqlserver12345 (10/18/2013)


    declare @count int

    declare @charvaluefront varchar

    declare @charvalueback varchar

    declare @frontpos int

    declare @backpos int

    select @count=len('ABC')

    set @frontpos=1

    set @backpos=@count

    while(@frontpos<=@count)

    begin

    select @charvaluefront=substring('ABC',@frontpos,1)

    select @charvalueback=substring('ABC',@backpos,1)

    set @frontpos=@frontpos+1

    set @backpos=@backpos-1

    print @charvaluefront

    print @charvalueback

    end

    How do I compare @charvaluefront and @charvalueback values to test...

    --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: palindrome

    mickyT (10/20/2013)


    The 'no reverse' is an interesting requirement.

    I believe what we have here is homework about how to use WHILE loops and the instructor probably never heard of a Tally...

    --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: palindrome

    sqlserver12345 (10/20/2013)


    I do not want to use reverse function.please check the code I posted and correct what wrong I did.thanks

    I'm curious... please explain why you don't want to use "REVERSE".

    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: palindrome

    sqlserver12345 (10/20/2013)


    I do not want to use reverse function.please check the code I posted and correct what wrong I did.thanks

    I'm curious... please explain why you don't want to use "REVERSE".

    --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: Tip: Calculated Table Truncate

    jonysuise (10/20/2013)


    Hi simonholzman 14059, and welcome to the forum 😀

    To delete a large number of rows switch the recovery model of your database (in your development environment) to bulk-log, run...

    --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 hide sensitive data in SQL 2000 table

    homebrew01 (10/20/2013)


    We were allowed to store CC numbers, but had to have various safeguards in place to be PCI compliant.

    When you say you "were allowed to store CC numbers", do...

    --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: Export Import entire database (or best method to accomplish this)

    ken def (10/19/2013)


    Hi

    I need to clean up a database. Main reason: datafiles have grossly disparate sizes. I'd like to export entire database (or some other meaningful method), resize...

    --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 simple ETL strategy with SSIS

    I don't use SSIS, so no help there. I just thought I'd mention that this would be incredibly easy and simple to do with a little Dynamic SQL.

    --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: DATE

    To help us help you, rather than posting a picture of the data, please see the first link under "Helpful Links" in my signature line below and post your 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: Query Optimization help

    - Win (10/11/2013)


    Thanks for your replies...

    I will consider all of the posts and replies..

    I can only hope that's true.

    Tell your company that it's no longer lawful to embed SSN's 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: Listing Years based on range

    born2achieve (10/19/2013)


    Also, none of the above queries executing correctly. i tried to check the query is working fine or not using

    http://sqlfiddle.com. Somethign wrong with the declaration. could you please...

    --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: Listing Years based on range

    born2achieve (10/19/2013)


    Hi Jeff Thanks for your response and great article. But i have a concern that you are using custom year next to the declaration.

    SELECT @fromYear='1913-01-01', @toYear='1998-01-01'

    I don't want...

    --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: Returning part of a string

    If the audit strings won't ever be longer than 8K, here's one way. It's quite generic so it won't necessarily be the fastest method but will still perform quite...

    --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: Listing Years based on range

    AmarettoSlim (10/19/2013)


    Can I ask why you don't want a loop? Recursion via a common table expression (CTE) can be your friend in this case.

    DECLARE @fromYear DATETIME, @toYear DATETIME

    SELECT @fromYear='1913-01-01', @toYear='1998-01-01'

    ...

    --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: Tip: Calculated Table Truncate

    It should handle foreign key constraints okay since the Truncate does not check them but I make no promises !

    You can't truncate a table that has foreign keys...

    --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 - 25,591 through 25,605 (of 59,102 total)