Forum Replies Created

Viewing 15 posts - 2,026 through 2,040 (of 4,087 total)

  • RE: Any tips on speeding this SQL up would be most helpful

    I've looked at this, and I have lots of questions. Specifically, it looks like a_site_id should be part of the primary key, but it is not used in any...

  • RE: Any tips on speeding this SQL up would be most helpful

    Both of these tables contain a foreign key to a table that you did not provide a definition for, so they will not run as written. You really need...

  • RE: SQL Query table relationships issue

    bzoom100 (1/5/2017)


    I've been copying the code as created by SQL Report Builder. Thank you for the advice on formatting. I'm learning. 🙂

    Part of the problem was that you didn't use...

  • RE: How to catch the record into exception/error table

    mcfarlandparkway (1/4/2017)


    we have a job(ssis package) where it load data from different source and destination is temp table. from temp table I have to move to main table.

    selecting rec from...

  • RE: How to code to find out different names with the same memberid?

    Lynn Pettis (1/5/2017)


    adonetok (1/5/2017)


    There are memberid and membername in one table member.

    One memberid shoud match only one membername.

    How to code to find out different names with the same memberid?

    select memberid,...

  • RE: replace null with another column

    Luis Cazares (1/5/2017)


    Rasmus Remmer Bielidt (1/5/2017)


    Both options have their uses for sure.

    I didn't see anybody making this point, but COALESCE() absolutely needs a non-null argument or it will throw an...

  • RE: Create incrementing group numbers for groups of 500 rows?!

    Another option is to use the OFFSET function that introduced in SQL 2012 and was specifically designed for paging.

    DECLARE @page_size INT = 500, @page_num INT = 1

    WHILE @page_num > 0

    BEGIN

    SELECT...

  • RE: replace null with another column

    Luis Cazares (1/4/2017)


    drew.allen (1/4/2017)


    Brandie Tarvin (1/4/2017)


    I like CASE personally because it allows me to alter values being returned (or add new information) where as COALESCE just returns the original value.

    But...

  • RE: Formatting Data for Reporting

    SQL Server is a database tool, not a reporting tool.

    SSIS is an ETL tool, not a reporting tool.

    SSRS is a reporting tool. Use the correct tool for the job.

    Drew

  • RE: Query Assistance

    Your expected results don't match your sample data. Specifically, 08400124 and 15512890 should be included and there is no record with 15507086, so that cannot appear in the results.

    Here...

  • RE: Username increment by 1 if already exists in table

    I treated this as a variation on the gaps and islands problem. This following works for your (extremely small) sample data.

    ;

    WITH usernames AS (

    SELECT *, ROW_NUMBER() OVER(PARTITION BY un.username...

  • RE: how to select rows based on an order of possible column values

    dndaughtery (1/4/2017)


    I have the following query where a column A can be the same but I have an order in which I want them returned based on values in a...

  • RE: how to select rows based on an order of possible column values

    This can be accomplished with a ROW_NUMBER().

    DECLARE @cities TABLE (

    city VARCHAR(25),

    stCHAR(2)

    )

    INSERT @cities(city, st)

    VALUES

    ('Danville', 'KY')

    ,('Danville', 'FL')

    ,('Danville', 'TN')

    ,('Marthasville', 'KY')

    ,('Marthasville', 'FL')

    ;

    WITH cities AS (

    SELECT c.city, c.st, ROW_NUMBER() OVER(PARTITION BY c.city ORDER BY s.state_priority)...

  • RE: replace null with another column

    Brandie Tarvin (1/4/2017)


    drew.allen (1/4/2017)


    Brandie Tarvin (1/4/2017)


    I like CASE personally because it allows me to alter values being returned (or add new information) where as COALESCE just returns the original value.

    But...

  • RE: Non-alphanumeric Search Frustration

    Thom A (1/4/2017)


    Brandie Tarvin (1/4/2017)


    Thom A (1/4/2017)


    I'm a little confused,on one part. You stated that "a hyphen is only allowed after the first character", however that the value "ABC-1245Z" is...

Viewing 15 posts - 2,026 through 2,040 (of 4,087 total)