Forum Replies Created

Viewing 15 posts - 2,716 through 2,730 (of 3,957 total)

  • RE: trailing space in len() problem

    ANSI_PADDING may not be set to the same value on both databases.

    Try:

    SELECT name, is_ansi_padding_on

    FROM msdb.sys.databases

    WHERE name = 'yourdatabase'

    On both databases to check this.

  • RE: sys.tables.type

    Look at the type column described here:

    http://msdn.microsoft.com/en-us/library/ms190324.aspx

    I believe sys.tables returns only type='U'

  • RE: How to transform this result?

    Here's another method that uses a correlated subquery:

    SELECT ITEM

    ,ITEM_DESC=(

    SELECT DESCRIPTION

    ...

  • RE: "Dynamic" view question

    What you are asking about sounds like the Virtual Private Database concept available in Oracle Enterprise Edition.

    I'm not sure if this link will help you or not but it is...

  • RE: string operation

    Just for fun and to show that there's always more than one way to skin a cat:

    DECLARE @s-2 VARCHAR(10) = 'tapsaw1'

    ;WITH rCTE (n, s) AS (

    SELECT...

  • RE: select rows where values appear consecutively

    This approach looks only at consecutive years also:

    declare @a table ([User] int, [Year] int, Status1 Char(4), Status2 Char(4), Status3 Char(4));

    insert @a values ( 1, 2011, 'Pass', 'Fail', 'Fail' );

    insert @a...

  • RE: sum every two number combination

    Sean Lange (9/25/2012)


    ChrisM@Work (9/25/2012)


    dwain.c (9/24/2012)


    Sean Lange (9/24/2012)


    And of course if the exact rows matter this can get a LOT more challenging because there may be more than 1 pair where...

  • RE: sum every two number combination

    Amy.G (9/25/2012)


    Thank you for this solution. I had originally tried to do a recursive cte, but though I'm beginning to understand how they work, I haven't been able to...

  • RE: sum every two number combination

    ChrisM@Work (9/25/2012)


    dwain.c (9/24/2012)


    Sean Lange (9/24/2012)


    And of course if the exact rows matter this can get a LOT more challenging because there may be more than 1 pair where the sum...

  • RE: sum every two number combination

    Sean Lange (9/24/2012)


    And of course if the exact rows matter this can get a LOT more challenging because there may be more than 1 pair where the sum is the...

  • RE: How Do You Keep The "Pieces" Of A Complex Statement "Organized"

    EdA ROC (9/24/2012)


    Note - The SQL statement I included is probably a one-time request.

    I'm wondering how much code I've written that was a result of a one-time request that ended...

  • RE: Display multiple row values in a single row.

    Like this:

    DECLARE @Names TABLE

    (Gender VARCHAR(6), Name VARCHAR(6), Age INT)

    INSERT INTO @Names

    SELECT 'Male','John', 52

    UNION ALL SELECT 'Female','Joe', 33

    UNION ALL SELECT 'Male','Jim',42

    SELECT Gender, Names=

    ...

  • RE: SELECT FOR UPDATE

    UPDLOCK is probably what you want.

    Here's another way that I believe will also work (no transaction needed).

    CREATE PROCEDURE [dbo].[sp_ATH_SyncEntity_Get]

    AS

    BEGIN

    DECLARE @Id BIGINT, @EntityID UNIQUEIDENTIFIER, @EntityType TINYINT, @EntityOperation...

  • RE: sql server Data Matrix.

    You are looking for someone to spoon-feed you a solution, without trying to examine exactly what UNIQUEnTuples does.

    -- Solution 4: Generate all combinations

    ;WITH UNIQUEnTuples (n, Class, Product, Tuples, Product2) AS...

  • RE: birthdays 30 days from now

    Not sure if this is the "best" way but it may work for you:

    declare @members table (mid int, birth_date date, first_name varchar(10), last_name varchar(10));

    insert into @members

    values (1,'1959-08-29','a','a'),(2,'1959-09-29','b','a'),(3,'1959-10-29','c','a'),(4,'2011-09-20','a','d');

    SELECT M.last_name, M.first_name, [Birth...

Viewing 15 posts - 2,716 through 2,730 (of 3,957 total)