Forum Replies Created

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

  • 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

    ...

  • 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

    ...

  • 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...

  • 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...

  • 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...

  • 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...

  • 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,

    ...

  • 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...

  • 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...

  • 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...

  • RE: can i open an analysis services database in BIDs

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

  • 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

    ...

  • 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...

  • RE: Flip data in SQL

    helal.mobasher 13209 (3/3/2015)


    Thanks Luic for dynamic SQL. Very elaborate and I need to test it. However, on your note "Are you seriously taking the advice and code from someone from...

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