Forum Replies Created

Viewing 15 posts - 1,126 through 1,140 (of 1,473 total)

  • RE: create a stored procedure with insert and update using a cursor

    paul.starr (11/12/2008)


    how do i find the base defined types for my Customers table?

    User Defined Data types are so much fun! I have over 1500 of them in my database.:crying:

    You...

    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: SQL query help

    Something like this?

    SELECT T.Table_Type, T.Table_Name, C.Column_Name

    FROM INFORMATION_SCHEMA.TABLES T

    INNER join INFORMATION_SCHEMA.COLUMNS C ON T.Table_Name = C.Table_Name

    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: Consolidating updates?

    I tackled it a bit differently. Example of the running totals[/url] theory applied below. The downside to this method is that you will get rows set to true...

    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: Need help with a while and cursor

    Steve T (11/11/2008)


    Garadin (11/11/2008)


    SQL DBA 808 (11/11/2008)


    Steve T: Yes. That's very close to what I need to do. Thank you.

    Garadin: I will read that and see...

    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 stored procedure with insert and update using a cursor

    I'm done.

    Seconded.

    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: Need help with a while and cursor

    SQL DBA 808 (11/11/2008)


    Steve T: Yes. That's very close to what I need to do. Thank you.

    Garadin: I will read that and see if I can...

    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: SQL COMPLEX QUERY - Urgent

    What happened to varchar 100! 😀

    How about something like this:

    [font="Courier New"]SELECT T1.ID,

       COALESCE(T2.Name, T3.Name, T4.Name) [Name],

       COALESCE(T2.Language, T3.Language, T4.Language) [Language],

       (SELECT [Description] FROM #Table1 WHERE ID = T1.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]

  • RE: Need help with a while and cursor

    SQL DBA 808 (11/11/2008)


    I think I would do this with the combination of a While and a Cursor.

    The Header record can and will appear many times in the course of...

    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 stored procedure with insert and update using a cursor

    A Case Statement should do the trick:

    insert into dbo.Customers (CustomerID, Name, ShortName, ReferenceNo, EffectiveDate, Status, CreateDate)

    select A.Account_number, A.Customer_name, A.Known_As, A.Legacy_Account_Number, A.Account_Established_Date, CASE WHEN A.Customer_Status = 'I' THEN...

    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: SQL COMPLEX QUERY - Urgent

    Guess this wasn't that urgent after all eh? :hehe:

    In any case, you were close. (Next time, explain how you tried to modify it and say that your modifications didn't...

    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 stored procedure with insert and update using a cursor

    Paul,

    This is becoming the Oracle post all over again. You supply very little data about your issue, and when we try to guess with your half supplied information, you...

    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: SELECT based on time interval between records

    If you are using sequential ID values, you could take the easy way out and use an outer self join on id = id-1. That said, if there are...

    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 stored procedure with insert and update using a cursor

    Jack Corbett (11/10/2008)


    Similar to what Seth has already said and based on your existing procedure:

    This would be that aforementioned "more elegant way". :hehe:

    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 stored procedure with insert and update using a cursor

    Shouldn't be necessary, and probably isn't efficient. I don't see the need for a cursor here.

    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 stored procedure with insert and update using a cursor

    Basic concept:

    IF EXISTS(Select * From SomeTable Where Condition = True) -- Test the existence of your data

    UPDATE SomeTable

    ...

    ELSE

    INSERT INTO Sometable...

    That works for one row. If you're wanting 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 - 1,126 through 1,140 (of 1,473 total)