Forum Replies Created

Viewing 15 posts - 5,131 through 5,145 (of 8,731 total)

  • RE: Dynamic SQL Truncating at 4K

    I'm sure I've been bitten by this issue before, but I'm trying to replicate it without success.

    Maybe it has something to do with this:

    From BOL

    The size of the string is...

    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: Delete takes a long time

    That's why my first suggestion was to insert only the missing transactions. You reduce your I/O especially with the accounts with lots of transactions.

    IF OBJECT_ID('Staging_Transactions') > 0

    ...

    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: Pivot Function

    Of course, you can do it with a Cross tab approach.

    It's all explained in here with comparisons to the pivot operator:

    Cross tabs Part 1[/url]

    Cross tabs Part 2[/url]

    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: Need SQL query for this scenario

    LoudClear (3/11/2015)


    Luis Cazares (3/11/2015)

    And just to note that you don't begin CTEs with a semi-colon, you terminate the previous statement (and all if possible) with it.

    I knew when I wrote...

    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: Need SQL query for this scenario

    LoudClear (3/11/2015)


    Here's a ultra-simplistic version.

    - Adam

    ;with Claim_Status as

    (

    select 100 as [Claim Number] , 1 as [Status]

    union all select 100, 3

    union all select 101, 1

    union all select 102, 1

    union all...

    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: Delete takes a long time

    Is TransactionID independent from AccountID? Or do you need to include AccountID to uniquely identify a transaction?

    How common is the use of the ID column?

    Do you have Foreign keys referencing...

    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: Second Friday of every month

    andyscott (3/11/2015)


    cbrammer1219 (3/11/2015)


    andyscott you actually had it returning Thursdays..

    Depends on your SET DATEFIRST settings: Whilst the default (English,US) is 7, meaning weeks start on Sunday, in the UK it is...

    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: Second Friday of every month

    You're using a recursive CTE that counts which can cause a disaster. Read the following link to know the implications: http://www.sqlservercentral.com/articles/T-SQL/74118/

    I came up with this formula in 2 versions.

    SELECT MonthStart,

    ...

    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: Delete takes a long time

    You could bulk insert into a staging table and insert the missing transactions. If needed, you could update the existing transactions.

    If it's not used, I would change the clustered index...

    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: Need help with displaying sum of records and show row even if it is blank or zero

    Or use RIGHT JOIN. 😉

    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: SSIS - using variables in Execute SQL Task

    You're abusing the GOs. GOs are batch separator, so variables won't be available in the next batch.

    The following part is useless.

    declare @columnz varchar (8000)

    go

    Remove all the GOs from your code...

    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: can i open an analysis services database in BIDs

    Koen Verbeeck (3/3/2015)


    Luis Cazares (3/3/2015)


    The option is in Menu File -> Open -> Analysis Services Database...

    Keep in mind that you are connected live to that SSAS database.

    If you make changes...

    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: can i open an analysis services database in BIDs

    The option is in Menu File -> Open -> Analysis Services Database...

    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: Find patients with age 6 months to 5 years

    Something like this?

    SELECT *,

    CASE WHEN DATEADD(MM, DATEDIFF(MM, DOB, ApptDt2), DOB) > ApptDt2

    THEN DATEDIFF(MM, DOB, ApptDt2) - 1

    ...

    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: SQL NOT IN question

    m.i.k.e (3/3/2015)


    Hi,

    I am working on a few exercises in SQL but I can't seem to finish the last one. I added the question in a picture and the code...

    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 - 5,131 through 5,145 (of 8,731 total)