Forum Replies Created

Viewing 10 posts - 1 through 10 (of 10 total)

  • RE: Setting Connection String from a ForEach File Enumerator

    For now I used some File System tasks to copy the file into a working copy with a file name that is set in the project parameter. So the...

  • RE: Finding Date Ranges

    Here is my solution.

    ;with cte_DateFill as (

    SELECT xD.[Date]

    ,xpa.ID

    ,xpa.company

    FROM #PosDates xPA

    JOIN @Date xD ON xD.DATE BETWEEN xPA.START_DATEAND ISNULL(xPA.END_DATE, GETDATE())

    GROUP BY xd.[Date], xPA.ID, xPA.COMPANY

    )

    ,cte_Groups as (

    SELECT ID

    ,Company

    ,[Date]

    ,DateGroup = DATEADD(dd, - ROW_NUMBER() OVER...

  • RE: Finding Date Ranges

    I hope you used the CROSS APPLY VALUES approach to UNPIVOT.

    You can read about it in the first article in my signature links.

    I did do unpivot. I'll check out...

  • RE: Finding Date Ranges

    WOOHOO! That did it!

    I unpivoted the start & end date into one date column. (had to group them to eliminate duplicates for some records) I joined...

  • RE: Finding Date Ranges

    Luis Cazares (1/14/2014)


    Does this article help you?

    http://www.sqlservercentral.com/articles/T-SQL/71550/

    That may do it, but I'll have to fill in all the days in between the start & end. Then plug those dates...

  • RE: Finding Date Ranges

    Here it is.

    CREATE TABLE #POSDATES (

    IDINT

    COMPANYTINYINT

    POS_IDTINYINT

    [START_DATE]DATE

    END_DATEDATE

    )

    INSERT INTO [#POSDATES]([ID],[COMPANY],[POS_ID],[START_DATE],[END_DATE])

    VALUES

    (333,1,1,CAST('20110902' as DATE),CAST('20120831' as DATE)),

    (333,1,1,CAST('20120901' as DATE),CAST('20120910' as DATE)),

    (333,1,1,CAST('20120911' as DATE),CAST('20120911' as DATE)),

    (333,1,1,CAST('20120912' as DATE),CAST('20130106' as DATE)),

    (333,1,1,CAST('20130901' as DATE),NULL),

    (999,1,1,CAST('20110902' as DATE),CAST('20120909' as DATE)),

    (999,1,1,CAST('20120910'...

  • RE: Query to variable - not wanting table style result

    Awesome! Thanks Gazareth!

    Now that I've read your post I vaguely remember hearing that invoke-sqlcmd returns the table and sqlcmd returns a string. There's no way I...

  • RE: Query to variable - not wanting table style result

    This is the closest I've come to finding a topic on what I'm trying to do. I'm setting a PS variable equal to the results from a query that...

  • RE: How to change IntelliSense timeOut in SSMS 2012?

    I'm running into the same behavior. SSMS 2012 intellisense won't do anything when I'm connected to SQL boxes that are hosted offsite. It won't even show me variables that...

  • RE: Can't get rid of #Error result

    I did try the IsNothing. I found two forms of that, the one you posted and another that looked like this:

    ...

Viewing 10 posts - 1 through 10 (of 10 total)