Forum Replies Created

Viewing 15 posts - 1,456 through 1,470 (of 1,473 total)

  • RE: Conditional JOIN in a view possible?

    Left Joins with an COALESCE?

    CREATE VIEW SSCTempView

    AS

    SELECT A.T1IDent, COALESCE(B.Value, C.Value) MyValue

    FROM Table1 A

    LEFT JOIN Table2 B ON A.T1Ident = B.T2Ident

    LEFT JOIN Table3 C ON A.T1Ident = C.T3Ident

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: OPENQUERY results

    Same method from the previous question should fix this. Select the results into a temp table and insert from there.

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Joining OPENQUERY (with variable) results SQL 2000

    You aren't storing the data you are selecting from the remote server anywhere.

    Instead of

    select @TSQL = 'select * FROM OPENQUERY(amisole, ''select room_code,asset_tag,description FROM asset where location_code = '''''...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Using CHARINDEX to find EITHER/OR pattern

    Tested the above patindex string under 2K and it works fine.

    OP:In your third example, you split the string twice. You will need to run the previous solution...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Updating a column with the sequence/order of a query

    As far as it trying to insert into the identity column, you can get around that by just explicity defining the fields you are inserting into:

    insert into #Ranking (MBR_Race_ID, Team_Points,...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: retrieve the next and the previous reference of a record

    What is your end goal here? There is probably a more efficient way to accomplish what you're asking. For example, tracking both the next and previous ID's per...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Count Months (periods) on program

    Is the data you supplied an actual example of your how data table is structured, or is that just to help explain what you need? If the latter, how...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Using Cartisian Joins

    Yes! I finally get to use a cross join for something!

    Setup:

    CREATE TABLE #Gender(

    Gendervarchar(10))

    INSERT INTO #Gender(Gender)

    VALUES('Male')

    INSERT INTO #Gender(Gender)

    VALUES('Female')

    INSERT INTO #Gender(Gender)

    VALUES('Unkown')

    CREATE TABLE #Age(

    Agevarchar(10))

    INSERT INTO #Age(Age)

    VALUES('13-17')

    INSERT INTO #Age(Age)

    VALUES('18-24')

    INSERT INTO #Age(Age)

    VALUES('25-29')

    INSERT INTO #Age(Age)

    VALUES('30-39')

    INSERT...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: ~Split ~double~~symbol

    REPLACE(@FilterCondition1, '~~', '~0~')

    You can put that inline with where you're splitting the rest of your string. Replace the Zero with whatever character you need for that value to show...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Splitting a String in SQL - Help Please!

    Due to the nature of our setup, involving a complete custom built front end application, which only communicates through a custom built middle layer(which we have no access to modify...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: count number of rows per hour per client and in the end total

    You're looking for something like this?

    Declare @StartTimedatetime,

    @EndTimedatetime,

    @Totalint

    SELECT Client, datepart(hh, YourDate) HourNumber, SUM([NumRows]) VRowCount

    INTO #1

    FROM YourTable

    WHERE YourDate BETWEEN @StartTime and @EndTime

    GROUP BY Client, datepart(hh,YourDate)

    SET @Total = (SELECT SUM(VRowCount)

    FROM #1)

    SELECT Client, HourNumber,...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Helpabout stored procedure

    Cast your @id as a varchar.

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Weird - Procedure expects parameter which was not supplied

    I'd also consider running a Trace and specifying textdata of:

    '%proc_insertorderdetails%' with SPStmtStarting, SPStmtCompleted, RPC:Completed and SQL:BatchCompleted turned on. That way, you will be able to see exactly how the...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Splitting a String in SQL - Help Please!

    We do... for any fields that we are able to change. However, some fields we can't change without getting our front end or middle layer modified. That one...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Splitting a String in SQL - Help Please!

    Getting back to my initial suggestion... aside from it being potentially slow / reliant on a '-' as a delimiter, is there any reason that wouldn't have worked?...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

Viewing 15 posts - 1,456 through 1,470 (of 1,473 total)