Forum Replies Created

Viewing 15 posts - 301 through 315 (of 686 total)

  • Reply To: group records by week

    Did the number of rows per day dictate a certain method for export?

  • Reply To: group records by week

    100,000 rows

  • Reply To: group records by week

    10,000 of thousands I expect for each of the 3 files...

  • Reply To: group records by week

    not sure I understand the question, but I'm looking all records from previous day that gets split out using:

    CASE WHEN datepart(hour, dt.dt_stamp) < 8 THEN 1

    WHEN datepart(hour, dt.dt_stamp) < 16...

  • Reply To: group records by week

    I was looking back at this example you sent:

    $queryResults = Invoke-SqlCmd ...;

    Then something like this would be one option (probably better options are available):

    $queryResults | ? {$_.Category -eq 1} |...

  • Reply To: group records by week

    wanted more of a script approach maybe a little easier for maint and debug down the road.

  • Reply To: group records by week

    I'm not opposed to xp_cmdshell, and was wanting the csv files to be pipe(|) delimited. These 3 files will be used in a P/S import

    process to SQL as kind of...

  • Reply To: group records by week

    It started with grouping records by week to see the amount of data, and once I saw that I needed it to break down by day in 8 hour increments....

  • Reply To: group records by week

    something like this?

    #Variables - details of the connection, stored procedure and parameters
    $connectionString = "server=ServerName;database='DatabaseName';trusted_connection=true;";
    $storedProcedureCall = "exec dbo.GetFileNames @param1";
    $param1Value = "SomeValue";

    #SQL Connection - connection to SQL server
    $sqlConnection...
  • Reply To: group records by week

    Thanks for comments and understand..

     

    Jeffrey,

    Would this method work to get my 3 output files?

    function ConnectToDB {
    # define parameters
    param(
    ...
  • Reply To: group records by week

    Thanks..

    Could you crave out a template to get me started?

  • Reply To: group records by week

    how could I wrap the S/P in Powershell to accomplish that task?

  • Reply To: group records by week

    Would I be able to create different output files based on in the SP?

    ,CASE WHEN datepart(hour, dt.dt_stamp) < 8 THEN ..... Create output file1

    WHEN datepart(hour, dt.dt_stamp) < 16 THEN .......

  • Reply To: group records by week

    Would I be able to give each row a Label?

    ,CASE WHEN datepart(hour, dt.dt_stamp) < 8 THEN 1

    WHEN datepart(hour, dt.dt_stamp) < 16 THEN 2

    ELSE 3

    END as 'HrReported'

    Instead of having a 1,2,3 ...

  • Reply To: group records by week

    Not having any luck trying to Insert The CASE into previous query.

    CASE WHEN datepart(hour, dt.dt_stamp) < 8 THEN 1

    WHEN datepart(hour, dt.dt_stamp) < 16 THEN 2

    ELSE 3

    END

    Like to see the break...

    • This reply was modified 3 years, 8 months ago by Bruin.

Viewing 15 posts - 301 through 315 (of 686 total)