Forum Replies Created

Viewing 15 posts - 7,231 through 7,245 (of 8,731 total)

  • RE: DIFFERENCE BETWEEN NOLOCK VS WITH(NOLOCK) IN SQL SERVER 2008

    In read-commited isolation level, readers don't block readers.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Determine the most recent datetime out of 3 columns

    mister.magoo (1/10/2014)


    or this, which I personally find more "readable", but that's probably just me...

    , (select max(moddate) from (values(P.ModifiedDate),(PD.ModifiedDate),(PA.ModifiedDate)) a(moddate)) AS ModifiedDate

    , (select max(credate) from (values(P.CreatedDate),(PD.CreatedDate),(PA.CreatedDate)) a(credate)) AS CreatedDate

    That's clever. I...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Determine the most recent datetime out of 3 columns

    It seems that a simple CASE statement will do the trick. Because your Modified date and Created Date columns are non-nullable on all tables, the query becomes simpler.

    SELECT --DISTINCT

    ...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Testing the Results of RESTORE VERIFYONLY

    I would follow hisakimatama's recommendations on the validation of your backups.

    However, to store the value returned by your restore statement, you could use dynamic code and sp_executesql to store the...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: TSQL Q from 461 book DATEDIFF

    There's an easier way to do this without using variables.

    SELECT 'The diff in years ' + DATEDIFF(YEAR, MIN(birthdate), MAX(birthdate))

    FROM hr.employees

    As Sean pointed out, you can't use a variable for your...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: The Desktop Setup

    I have some SW essentials and some nice to have, most of them have already been mentioned.

    Essentials:

    SSMS

    BIDS

    Word processor

    Spread sheet SW

    Email SW

    Internet access

    Nice to have:

    Notepad++

    Chrome

    Code formatter

    But something that hasn't been mentioned...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Complex Query. Please help

    To get this query, i would use nested CTEs (or subqueries) first using a RANK() function to determine which products I will include, then ROW_NUMBER() on the result to get...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: SEPERATING NUMERIC & ALPHABETICAL VALUES FROM STRING

    Here's one solution using a cteTally. You could turn this code into an inline table-valued function to use it against a query. If you have any questions on how it...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: How to Get The O/P fro These Table

    If the intention is to simplify, here's another option.

    SELECT a.invoic_no, a.item_no

    ,Sales= CASE WHEN item1 = a.item_no THEN a.invoic_qty ELSE 0 END

    ,Free=...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Display data

    Could you provide DDL, sample data and expected results in the form of insert statements? You can read on how to do it in the article linked in my signature.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Values as per rules

    John,

    It seems to be more than that as it depends on a hierarchy. This is a duplicate post and it was originally posted here.

    http://www.sqlservercentral.com/Forums/Topic1529451-391-1.aspx

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Conversion failed when converting the varchar value '1*2*3' to data type int.

    I hope that it helps you. If you have any more questions, feel free to ask 😉

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Proivde Hierechy wise sum and display all

    You might want to review your sample data as it won't give the expected results. Root for ship and boat is air and some multiplications won't give the values you...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: So Simple, But Yet ....

    If see 2 options:

    A. You're using a different column from Table1 (email & email1), but it could be a transcription error.

    B. You have null values on email column, check this:

    select...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Dataype question

    For SSIS, the data type should be DT_DATE or DT_DBTIMESTAMP2.

    If you try to convert '2011-04-26-08.02.51.036000' to a datetime2 in SQL Server, you'll get an error. A different format is needed...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

Viewing 15 posts - 7,231 through 7,245 (of 8,731 total)