Forum Replies Created

Viewing 15 posts - 46 through 60 (of 562 total)

  • Reply To: Convert UNION to a JOIN

    I don't see how this is possible. UNION is a combination of rows, provided that order and number of columns are the same and have compatible datatypes. JOIN is more...

  • Reply To: Convert DATETIME to a date in ISO format

    Thank you Thom,

    In my configurations that example gave the 'same' results. (But yes that depends on the regional/language settings. Didn't notice that in my examples 🙁   ).

    Ben

     

    Why do Americans have...

  • Reply To: Get Records from UDT

    Whizkid wrote:

    If any exception when inserting record into Parent table it’s going to Catch block, but the identity value is getting skipped by one. For eg. I’ve 3 records in...

  • Reply To: Convert DATETIME to a date in ISO format

    Thom A wrote:

    Even yyyy-MM-dd is not ambiguous, as it is interpreted differently when using the (small)datetime datatype to the other date(time) datatypes.

    I do not understand this. Is it 'not ambiquous'/'ambiguous'/'not unambiquous'.

    I...

  • Reply To: How to write code to see if number is greater than or within a limit -healthcare

    The test data:

    drop table dmelist

    CREATE TABLE DMELIST(
    MAXORDERBY INT,
    MONTH_YEAR DATE,
    CARRIERMEMID VARCHAR(20),
    SERVCODE VARCHAR(10),
    LIMIT VARCHAR(50))
    INSERT INTO DMELIST (MAXORDERBY,MONTH_YEAR,CARRIERMEMID,SERVCODE,LIMIT) VALUES ('2','1/1/2018','123456789','E0720','1 60 months');
    INSERT INTO DMELIST (MAXORDERBY,MONTH_YEAR,CARRIERMEMID,SERVCODE,LIMIT) VALUES ('4','2/1/2018','123456789','A4556','3 month');
    INSERT INTO DMELIST...
  • Reply To: How to write code to see if number is greater than or within a limit -healthcare

    You have provided a query. Without the data the query has to be reverse enginered to understand both the query and the data.

    So providing data might help to understand te...

  • Reply To: Changing table data

    /*Create new colunm TimeOnly */
    ALTER TABLE ['Job info$']
    ADD [TimeOnly] DATETIME NOT NULL

    The Datetype DATETIME does always store both the date and the time. You can alter the...

  • Reply To: Generate Duplicate Value Range Based

    --------------------------------------------------------------------
    -- ben brugman
    -- 20190419
    --------------------------------------------------------------------
    -- DROP TABLE F1

    -- Create data.
    SELECT * INTO F1 FROM
    (
    SELECT 1 AS Batch_ID , 2AS ROW_ID ,53 AS Last_Row,7247564 PIF
    UNION ALL
    SELECT 1,54,305,7495906
    UNION ALL
    SELECT...
  • Reply To: Generate Inserts.

    Thanks Sue,

    Yes I have been using that stored procedure also for a long time. At the moment I am generating the Meta data and the content. The meta is not...

  • Reply To: Random DateTime Range

    -- ben brugman
    -- 20190416
    -- Generate random date's within 2019

    declare @start datetime = '20190101'
    ;
    WITH
    L0 AS(SELECT 0 AS c UNION ALL SELECT 0 UNION ALL SELECT 0...

    • This reply was modified 5 years, 7 months ago by  ben.brugman.
  • Reply To: Simplest way to (automatically) output query results to csv

    Bit late maybe.     😉

     

    Powershell gives posibilities to execute code and get the result of that in a file. Executing the supplied code and using Powershell you can create a...

  • Reply To: File System Manipulation Within a Function

    A piece of code I use to get the file names from a folder.

    This can be used in a stored procedure, not in a function. Maybe this does help.

    Ben

                

    April 11, 2019 at 2:09 pm

    #3125342

  • Reply To: Simplest way to (automatically) output query results to csv

    A testset, containing linebreaks, delimiters within fields, textqualifiers within fields. A a long list of characters within fields.

    Greetings,

    Ben

    ---------------------------------------------------------------------------------
    -- Minimalistic CSV_Table ...
  • Reply To: Simplest way to (automatically) output query results to csv

    The short solution contains :

    ,@S CHAR(999)='+''"''+REPLACE(CONVERT(VARCHAR(MAX),
    ,121),''"'',''""'')+''";'''

    The symbol Q was Bracketed, in the row below the same line, but there the Q is not bracketed. The Q should...

    • This reply was modified 5 years, 7 months ago by  ben.brugman.
    • This reply was modified 5 years, 7 months ago by  ben.brugman.
  • Reply To: Simplest way to (automatically) output query results to csv

    And a longer solution.

    (Extra headers can be removed other adaptations are possible).

    ---------------------------------------------------------------------------------------------------------
    ---------------------------------------------------------------------------------------------------------
    -- Generate and execute CSV code. Header and Data type lines include (optional). ...

Viewing 15 posts - 46 through 60 (of 562 total)