Forum Replies Created

Viewing 15 posts - 991 through 1,005 (of 1,473 total)

  • RE: Finding records based on a value from consecutive date records

    No problem Stu, thanks for the inserts. This also allows me to fix the numerous issues my last method had.

    [font="Courier New"]CREATE TABLE visit(

    VisitID        INT,

    StudentID  INT,

    visitDate  DATETIME,

    score      INT,

    PRIMARY KEY CLUSTERED (StudentID, VisitDate,...

    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

    Can you provide new sample data / results to illustrate what you're looking for now? (Please post it in the fashion I did in my original post, with 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: Adding a new column in 320 table

    I think he'd want: sp_MSForEachTable (And it uses a cursor anyways, but it does save some typing and probably looks a bit cleaner overall)

    And with the indexes, you could...

    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

    I think the problem with one if statement is the inline GO's for the alter table. I've got a mid procedure alter table in production and it works fine...

    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...

    Where are you getting the information on what the status of each room is? It's not in this query. Do you already have another way to get that...

    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: Trigger ??

    Unfortunately, your'e not.

    This is the way I understand your setup, please correct me where wrong:

    You are inserting data into tableA.

    If that data is more than 512 characters, you would like...

    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: Trigger ??

    If you needed a trigger at all, it would be on Table A, as that is where you are inserting your data.

    However, situations like this are normally handled by what's...

    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: Adding a new column in 320 table

    As far as #1 goes, a cursor with the names of all your tables and some dynamic sql should handle it.

    For the second part... that sounds dangerous and arbitrary and...

    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: How to add multiple Dates Columns together but adding only date without times

    If you can't get that to work for you, here is a link to the equivalent online page:

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

    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: How to add multiple Dates Columns together but adding only date without times

    Joe,

    The link wasn't intended to be used on the internet, it's a link for MS Help. If you open up your books online (Hit F1 from SSMS...

    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...

    You're looking more along the lines of UNPIVOT instead of concatenation then. Since you have no idea what your maximum number of rooms can be, you're also looking at...

    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 distinct rows with two fields as primary key

    This may not be the most efficient way:

    SELECT COUNT(*)

    FROM (SELECT DISTINCT ReqID, ClientID FROM employees) E

    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: Oracle KEEP Function

    Don't know much about oracle, but if this doesn't get answered, try a different approach. Add some sample data that can demonstrate how keep works (see the link in...

    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: Join question

    ARE the month/date/hour columns common to both? They're coming from two different tables and one says start and the other says end. Are the two different tables/fields going...

    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: How to join tables on PK/FK AND t1.field1 <> t2.field1

    Something like this?

    SELECT *

    FROM Table1 T1

    INNER JOIN

    (SELECT T2I.Reg_ID, Status

    FROM Table2 T2I

    INNER JOIN (SELECT Reg_ID, MAX(history_date) History_Date

    FROM Table2

    GROUP BY Reg_ID) T2D

    ON T2I.Reg_ID = T2D.Reg_ID...

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