Forum Replies Created

Viewing 15 posts - 376 through 390 (of 1,229 total)

  • RE: Need Alternate Solution

    sqlbi.vvamsi (1/22/2013)


    this should suffice

    declare @mn money=-1000000

    select replace(CONVERT(varchar(50),@mn,1),'.00','') as mn

    No, that's "Western" format. The OP requires Indian format. This Wiki article gives a good explanation.

  • RE: ORDER BY non-sequential number sequence

    WolfgangE (1/14/2013)


    ....

    The disadvantages using the cross-apply-method I see are performance and maintenance:

    If the number of rows of the outer select increases the query will slow down as the apply-operator does...

  • RE: SQL Query

    Hi Paul

    Your sample data set doesn't have a matching row between MG_VSLVOY_HEADER and MG_VSLVOY_PORT_CONTROL:

    SELECT ncv.*, vh.VSLVOY_HEADER_ID

    FROM NCV_BL ncv

    JOIN MG_VSLVOY_HEADER vh

    ON ncv.saisan_VESSEL_CD = vh.VESSEL_CD

    AND ncv.saisan_VOYAGE_CD = vh.VOYAGE_NUM

    AND ncv.saisan_LEG_CD =...

  • RE: ORDER BY non-sequential number sequence

    select x.NewSid, sid

    from tbl_xenix

    CROSS APPLY (SELECT NewSid = ('S'+CAST ([statusId] AS VARCHAR(255)))) x

    order by CHARINDEX(x.NewSid,'S5S4')

  • RE: Find Fields that are True

    terrygefael (1/5/2013)


    Hi, Folks! Need help.

    I have a simple table with 29 fields(unique id, 14 True/False, 14 text)

    I want to find all fields relating to one unique ID that are true.

    Example:

    SELECT...

  • RE: Using Results from one column to calculate another column

    Use CROSS APPLY.

    SELECT

    x.Results1,

    CASE WHEN x.Results1 > 42 THEN ...

    FROM ...

    CROSS APPLY (SELECT... VERY LONG FORMULA as Results1) x

    WHERE x.Results1 =...

  • RE: How can I get join not duplicate?

    Read the link in my sig (please read this) to see how to generate and post readily-consumable sample data. If folks can get to work on your problem using cut-and-paste...

  • RE: help with this query!!!!

    Where in this code do you populate table #sid?

    sqldba_newbie (10/28/2012)


    My goal here to apply the condition to the query while joining the table instead of doing it at the end....

  • RE: Using the "IF" function in a column

    jrichards54 (10/28/2012)


    Is it possible to use the "IF" function in a column at design time as the value for that field? I do it regularly in Excel with no problem...

  • RE: Are the posted questions getting worse?

    L' Eomot Inversé (10/27/2012)


    L' Eomot Inversé (10/26/2012)


    WayneS (10/25/2012)


    Anyone still alive out here? 3 days with no comments... that has to be a record for The Thread.

    Some malware has reduced my...

  • RE: Today's Random Word!

    Revenant (10/27/2012)


    crookj (10/26/2012)


    Brandie Tarvin (10/26/2012)


    Rat

    Ben

    MJ song

    MJ brownies

  • RE: Loop through table to group associated records

    scarlam (10/24/2012)


    Any ideas on how to go about writing a script or stored procedure that can loop through this table.

    You're a programmer, you work to a specification -...

  • RE: Extracting Data from single table

    dthmtlgod (10/15/2012)


    I only want the records with a 1 and not a 5 status

    ;WITH SampleData (TICKET, [STATUS]) AS (

    SELECT 9543, 1 UNION ALL

    SELECT 9543, 5 UNION ALL

    SELECT 9543, 5 UNION...

  • RE: How do I join tables, but select top 1 from 1-many tbl?

    Don. (10/28/2012)


    ChrisM@home (10/28/2012)


    Thanks for the feedback, Don. The script in bold - is it the 2000-compatible one?

    Morning Chris,

    It was the following script you gave me help with:

    SELECT c.*, h.* ...

  • RE: How do I join tables, but select top 1 from 1-many tbl?

    Don. (10/28/2012)


    ChrisM@home (10/17/2012)


    Eric M Russell (10/15/2012)


    If Don has time, it would be interesting to know how this triangular join method compares to the aggregate methods. With small partitions it could...

Viewing 15 posts - 376 through 390 (of 1,229 total)