Forum Replies Created

Viewing 15 posts - 211 through 225 (of 1,082 total)

  • RE: IDENTITY seed/increment not resetting after transaction rollbacks

    try putting this after your rollback:

    DBCC CHECKIDENT (#T1,reseed,0)

    DBCC CHECKIDENT (#T1,reseed)

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Convert varchar to numeric

    this might work, by converting the numeric to varchar instead.

    select *

    from thangela.NpowerNorthern_v1 a INNER JOIN EPPS.dbo.Customers b ON b.MPANCORE = CAST(a.MPAN1 as VARCHAR)

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Convert varchar to numeric

    are you sure that all your varchar values are numerically compatebly?

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Newbie question for small query

    SELECT p.Name, sCost, mCost, hCost, tCost

    FROM TProject p

    OUTER APPLY (SELECT SUM(Cost) as sCost,idProject FROM TSoftware WHERE idProject = p.idProyect GROUP BY idProject) s

    OUTER APPLY (SELECT SUM(Cost) as mCost,idProject FROM...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Newbie question for small query

    Is the project not the top level here.

    Also should you query not look like this.

    SELECT p.name, SUM(s.cost) AS Software, SUM(m.cost) AS Material, SUM(t.cost) AS Travel, SUM(h.cost)...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Newbie question for small query

    Please could you supply some sample data.

    I've added the following data and I don't get any duplicates.

    One thing to please check is that there are no duplicate names in your...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Avoiding Dynamic Queries

    Here is an article that Gail touches on about this topic.

    http://sqlinthewild.co.za/index.php/2009/03/19/catch-all-queries/

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Getting the Results witout using SubQuery

    [Code]

    DECLARE @YourTable TABLE

    (ScheduleuserId INT,Userid INT, Status INT)

    INSERT INTO @YourTable

    SELECT 1, 1, 0 UNION ALL

    SELECT 1, 2, 1 UNION ALL

    SELECT 1, 3, 2 UNION ALL

    SELECT 1, 4, 0 UNION ALL

    SELECT...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Query to return parent records with no child records

    be careful, because it isn't always the best option...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Query to return parent records with no child records

    Out of interest which method did you take?

    I'm with Jack on this, I have started moving to NOT EXISTS as I also find that I often get better performance...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Compare Table date with current date

    just remember that your solution does not take into account time.

    so for example if you run the query at 2009-04-21 16:38.59

    Then anything before 16:38.59 on the 2009-04-14 will not be...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Compare Table date with current date

    Could you post the solution?

    this will help any others searching for a similar solution 🙂

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Compare Table date with current date

    I agree 100% 🙂 I think the tools for your solution have now been provided and working out the last part will provide a good learning platform for you to...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Compare Table date with current date

    Try give it a go.

    So you here is your current date:

    15/01/2009

    try and right the code.

    What you want to try and do is either.

    Make you [TableDate] > currentdate - 7 days...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Understanding execution plan

    thanks Grant 🙂

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life

Viewing 15 posts - 211 through 225 (of 1,082 total)