Forum Replies Created

Viewing 15 posts - 2,956 through 2,970 (of 3,957 total)

  • RE: sql query prob

    Can you post some DDL and sample data so I can check?

    It may depend on the type of your sal column.

    RTRIM(ISNULL(abc, '')) = ''

    The above code converts abc (character string)...

  • RE: SQL Beginner

    Sorry. Let's try that one more time.

    ;WITH CTE1 AS (

    SELECT TOP 100 PERCENT Origin, Destination, Tonnage

    FROM #Trips

    ORDER...

  • RE: sql query prob

    Try:

    select *

    from tablename

    where RTRIM(ISNULL(id, '')) = '' or RTRIM(ISNULL(name, '')) = '' OR RTRIM(ISNULL(sal, '')) = ''

  • RE: SQL Beginner

    Interesting. I found a way to force it to work.

    ;WITH CTE AS (

    SELECT c.Origin, c.Destination, c.Tonnage

    ,n=ROW_NUMBER() OVER...

  • RE: SQL Beginner

    Jeff is probably right, of course.

    However I thought I'd try this using a quirk I've seen in CROSS APPLY VALUES with respect to the order of the results...

  • RE: Use Of TableValueConstructor

    ChrisM@Work (8/24/2012)


    TVC implies a set of row value expressions; single-row value expressions can be very useful, see this article [/url]by Dangler Dwain.

    Just what am I dangling? I didn't think...

  • RE: find a grouping with at least one row within the group containing a certain value

    Something like this perhaps?

    DECLARE @t TABLE (Name VARCHAR(10), [TYPE] VARCHAR(10), Price MONEY)

    INSERT INTO @t

    SELECT 'nameA', 'typeA', 1.00

    UNION ALL SELECT 'nameA', 'typeB', 2.75

    UNION ALL SELECT 'nameB', 'typeA', 2.00

    UNION ALL SELECT 'nameC',...

  • RE: Insert data from unnormalized table into 3 new tables

    saschup (8/24/2012)


    Thanks Fishman! This worked snazzily. I really appreciate the help from you and Ev. I can use these tips for all the other migration tasks I...

  • RE: Substrating the columns from two queries

    ChrisM@Work (8/24/2012)


    Shadab Shah (8/23/2012)


    Hi,

    I have one query as SELECT A FROM TEMP1.

    And the other query as SELECT B FROM TEMP2.

    Now i want the answer to be shown as A-B.

    I don't...

  • RE: String concatenation

    J Livingston SQL (8/24/2012)


    whar results are supposed to be returned for this data set?

    CREATE TABLE #Test

    (ID int NOT NULL IDENTITY(1,1) Primary key,

    TranID int NOT NULL,

    OriginCode varchar(5) NOT NULL,

    DestinationCode...

  • RE: String concatenation

    There is a faster way though.

    SELECT TranID, RouteInfo=

    (

    SELECT OriginCode + ''

    FROM (

    ...

  • RE: Simultaneous read and write in SQL server 2008

    A deadlock will throw this exception:

    Error Number: 1205

    Error Severity: 13

    Error State: 13

    Error Message: Transaction (Process ID 78) was deadlocked on lock | communication buffer resources with another process and has...

  • RE: Tally OH! An Improved SQL 8K “CSV Splitter” Function

    ChrisM@Work (8/24/2012)


    SQL Kiwi (8/24/2012)


    ...This is not a democracy....

    Absolutely. The weight of opinion won't magically change the way SQL Server works, or anything else for that matter - and yet it's...

  • RE: Insert data from unnormalized table into 3 new tables

    Depending on how many legacy rows you need to convert, you may want to consider this approach to the phone numbers:

    INSERT INTO #TempPhone

    ( ContactID, PhoneTypeID, PhoneNumber)

    SELECT

    ContactID, n, Phone

    FROM

    #TempLegacy

    CROSS APPLY (

    ...

  • RE: Substrating the columns from two queries

    Since row ordering is not guaranteed by SQL, how do you know you're subtracting the right numbers at each row?

Viewing 15 posts - 2,956 through 2,970 (of 3,957 total)