Forum Replies Created

Viewing 15 posts - 106 through 120 (of 144 total)

  • RE: How to find second maximum record

    Your question is very unclear.

    Maybe you mean something like.

    SELECTMAX(Val)

    FROMTable

    WHEREVal < (SELECT MAX(Val) FROM Table)



    For better, quicker answers on T-SQL questions, read Jeff Moden's suggestions.[/url]

    "Million-to-one chances crop up nine times out of ten." ― Terry Pratchett, Mort

  • RE: CONTAINED DATABASE OR NOT ...

    With containment type partial I also get the error.

    Can workaround with:

    WHEN $action COLLATE SQL_Latin1_General_CP1_CI_AS = 'DELETE' THEN 'REMOVED'

    I found these articles which might be of help :

    http://technet.microsoft.com/en-us/magazine/hh534404.aspx

    http://msdn.microsoft.com/en-us/library/ff929080.aspx



    For better, quicker answers on T-SQL questions, read Jeff Moden's suggestions.[/url]

    "Million-to-one chances crop up nine times out of ten." ― Terry Pratchett, Mort

  • RE: CONTAINED DATABASE OR NOT ...

    Your code works for me on both

    2008 (10.50.1600) Enterprise

    2012 (10.0.2100) Evaluation

    Both results are the same.

    $actionACTIONnamename

    INSERTADDEDcaseNULL

    I can reproduce your error by forcing an incorrect collation:

    CASE

    WHEN $action COLLATE Latin1_General_CI_AS = 'INSERT'...



    For better, quicker answers on T-SQL questions, read Jeff Moden's suggestions.[/url]

    "Million-to-one chances crop up nine times out of ten." ― Terry Pratchett, Mort

  • RE: Recursive CTE

    Ok thanks anthony.green, much clearer now!

    The point of the query would be to find the parents / grandparents, but your inclusion of the new column helped my understanding a lot.

    Cheers...



    For better, quicker answers on T-SQL questions, read Jeff Moden's suggestions.[/url]

    "Million-to-one chances crop up nine times out of ten." ― Terry Pratchett, Mort

  • RE: Strange character stripping when concatenating

    I think that is reserved blob space. That is to say that it gets handled differently after it excedes 8000 characters.

    check out this post:

    http://www.sqlservercentral.com/Forums/Topic647815-145-1.aspx

    When copying'n'pasting the this last result into...



    For better, quicker answers on T-SQL questions, read Jeff Moden's suggestions.[/url]

    "Million-to-one chances crop up nine times out of ten." ― Terry Pratchett, Mort

  • RE: Recursive CTE

    Thanks for your replies!

    I nearly heard the click of comprehension.

    @anthony-2.green

    Indeed no level 2 with that data.

    Adding in:

    ('Svr4', 'DB1', 'Rep_DB1_b', 'Svr5', 'DB1'),

    ('Svr4', 'DB3', 'Rep_DB3', 'Svr5', 'DB3')

    Does give a level 2.

    But the...



    For better, quicker answers on T-SQL questions, read Jeff Moden's suggestions.[/url]

    "Million-to-one chances crop up nine times out of ten." ― Terry Pratchett, Mort

  • RE: CONTAINED DATABASE OR NOT ...

    Hi,

    The only thing I can think of is replacing:

    ON( Target.name = Source.name )

    with

    ON( Target.name COLLATE Latin1_General_CI_AS = Source.name COLLATE Latin1_General_CI_AS )

    Hope this helps.



    For better, quicker answers on T-SQL questions, read Jeff Moden's suggestions.[/url]

    "Million-to-one chances crop up nine times out of ten." ― Terry Pratchett, Mort

  • RE: Convert single table to parent-child tables.

    Maybe this'll help.

    INSERT INTO Parent

    SELECTLastName, FirstName, Address, City, State, Zip

    FROMOriginal

    INSERT INTO Child

    SELECTP.ParentID, 1 DocType, O.SSN

    FROMParent P

    INNER JOIN [Original] O

    ON P.[FirstName] = O.[FirstName]

    AND P.LastName= O.LastName

    AND P.Address= O.Address

    AND P.City= O.City

    AND P.State=...



    For better, quicker answers on T-SQL questions, read Jeff Moden's suggestions.[/url]

    "Million-to-one chances crop up nine times out of ten." ― Terry Pratchett, Mort

  • RE: Continuing career with SQL

    Just google "top SQL books", you'll find plenty. No one can tell you which one is the best for you. You'll have to decide youself. You could alway get another...



    For better, quicker answers on T-SQL questions, read Jeff Moden's suggestions.[/url]

    "Million-to-one chances crop up nine times out of ten." ― Terry Pratchett, Mort

  • RE: Ideal Shrink Size

    Assuming you are using Full Recovery, backing up you log regulary will keep it from growing out of hand.



    For better, quicker answers on T-SQL questions, read Jeff Moden's suggestions.[/url]

    "Million-to-one chances crop up nine times out of ten." ― Terry Pratchett, Mort

  • RE: Release unused space in the mdf file

    Hi,

    If space is an issue you can archive data from you biggest tables and make them accessible via a view.

    When you archive data based on years to seperate DBs,...



    For better, quicker answers on T-SQL questions, read Jeff Moden's suggestions.[/url]

    "Million-to-one chances crop up nine times out of ten." ― Terry Pratchett, Mort

  • RE: Sql server 2012 connection

    Hi,

    You can also add sqlserver.exe to your firewall exception (Without any ports). That'll allow you to use dynamic ports.



    For better, quicker answers on T-SQL questions, read Jeff Moden's suggestions.[/url]

    "Million-to-one chances crop up nine times out of ten." ― Terry Pratchett, Mort

  • RE: Update one table rows with another table if match found

    Hi maruthipuligandla,

    The requirement is to make your problem as clear as possible so that we can help you better.

    Take the time to script a table and test data. That way...



    For better, quicker answers on T-SQL questions, read Jeff Moden's suggestions.[/url]

    "Million-to-one chances crop up nine times out of ten." ― Terry Pratchett, Mort

  • RE: IF Backup Devices Deleted

    If you have any other backup devices, check out where they are pointing to. Maybe the file you need is in the same location.



    For better, quicker answers on T-SQL questions, read Jeff Moden's suggestions.[/url]

    "Million-to-one chances crop up nine times out of ten." ― Terry Pratchett, Mort

  • RE: IF Backup Devices Deleted

    Ask to get permission, or ask someone else to look for you. 🙂



    For better, quicker answers on T-SQL questions, read Jeff Moden's suggestions.[/url]

    "Million-to-one chances crop up nine times out of ten." ― Terry Pratchett, Mort

Viewing 15 posts - 106 through 120 (of 144 total)