Forum Replies Created

Viewing 15 posts - 976 through 990 (of 1,473 total)

  • RE: Create a temp field within a select statement ?

    ifila (12/5/2008)


    I tried again and it did. duh!

    What i need to do is manage the records in unique order based on the temp field which equals 'field1+field2+field3'

    Would i need to...

    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: Create a temp field within a select statement ?

    Why won't it work?

    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: Problem with compilation of SQL Code

    That works. However, in the large SP, the logic goes:

    Create Temp Table

    ...

    Insert into Temp Table

    Update a bunch of fields in the temp table for various reasons

    ...

    Alter Temp Table if...

    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: Problem with compilation of SQL Code

    GilaMonster (12/5/2008)


    Garadin (12/5/2008)


    RESULT:

    Server: Msg 207, Level 16, State 1, Procedure Seth_ACTest, Line 13

    Invalid column name 'B'.

    No clue why it works in one and not the other.

    I ran your...

    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: Problem with compilation of SQL Code

    My curiosity aside, the dynamic SQL alter statement may work for you baumgaertner, as it is only having issues on a 2000 server, and I'm assuming you're using 2005.

    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: Problem with compilation of SQL Code

    Indeed, I can run it fine on 2K8 as well, our production server is still 2K though, and it fails there.

    The other procedure is running fine on 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: Create a temp field within a select statement ?

    It's a datatype issue. This is why it's best to give all the information you can the first time, as I'd have warned you about this. You need...

    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: Problem with compilation of SQL Code

    This is in one of the SP's that I wrote quite a while back, and it works fine.

    ...

    CREATE TABLE #temp_final_results (

    ... -- A whole bunch of fields, but...

    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: Finding records based on a value from consecutive date records

    No problem Stu, glad we could help.

    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: Add Sum at the end of the column!

    Joe,

    Once again... Please refer to the link in my signature for how to provide proper sample data. You'll get better and faster answers to your questions if you do...

    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: Create a temp field within a select statement ?

    You mean something like?

    SELECT A, B, A + B, A + ', ' + B

    FROM Something

    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: find @mon and @fri based on date

    Just saw the end part about wanting the EOD. This EOD friday seems a bit sloppy and could likely be improved upon.

    [font="Courier New"]SET DATEFIRST 1

    SELECT    

       DATEADD(wk, DATEDIFF(wk,0,GETDATE()), 0)...

    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: find @mon and @fri based on date

    Just had to do one of these this morning actually.

    SET DATEFIRST 1

    SELECT DATEADD(wk, DATEDIFF(wk,0,GETDATE()), 0) Monday,

    DATEADD(wk, DATEDIFF(wk,0,GETDATE()), 0)+4 Friday

    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: help with recursive query

    sisernhagen,

    Note that Peso's solution won't work if you're using SQL 2000.

    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: Convert Rows to columns so...

    fausto usme (12/4/2008)


    I'll prefer in database because the data come already. what do you thing about???

    From a simplicity standpoint... it *might* be easier to have the database send it to...

    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 - 976 through 990 (of 1,473 total)