Forum Replies Created

Viewing 15 posts - 47,761 through 47,775 (of 49,552 total)

  • RE: Many to Many joins,insert

    Looks good. The main problem now is that there's no way to tell which instructor taught which student.

    Perhaps, instead of the InstructorCourse table, have a table which stored the occurences...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Update a table from select statement results

    Pleasure.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Update a table from select statement results

    As an aside, why are you storing dates as strings instead of datetimes?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Update a table from select statement results

    In that case, you need an insert statement, not an update.

    Insert puts new rows into a table, update modifies existing rows in the table.

    Insert into dbo.MetaEvents (MetaFYStamp, MetaPerStamp, MetaDateStamp)

    select cast([Fiscal...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Update a table from select statement results

    How many rows are in MetaEvents?

    Also, there's no join between MetaEvents (the table you're updating) and calender (the table that the values are coming from)

    What determines which row...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: How to get distinct records

    Do you want the two records with the lowest dates, or all the records that have the minimum date in the table?

    If the first, try top. If the second...

    SELECT TheDate,...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Check if temporary table exists or not?

    Arun T Jayapal (1/7/2008)


    if (object_id('tempdb..#tblTemp','u') > 0)

    print 'exists'

    else

    print 'not exists'

    ...its not compiling...:ermm:

    Looks fine, and runs fine for me. What's the error that you're getting?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: update statistics

    SELECT OBJECT_NAME(object_id), name FROM sys.stats

    will show you all the statistics that exist in the DB

    DBCC SHOW_STATISTICS ('Table name','Statistics Name')

    will give you the breakdown of the stats.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Isnull function

    You should always specify column names in an insert. Otherwise if the structure of the table changes, you code breaks. Whether you explicitly state default values, or leave them out...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Isnull function

    Generally I would recommend leaving the connection settings at their default values, unless you have a good reason to change them, and you know exactly what changing them will do.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Many to Many joins,insert

    Nice DB. Beter than I've seen a lot of professionals do.

    Few points.

    Bigints everywhere. Are you expecting more than 2.1 billion students?

    The StudentCourseInstructor table looks misnamed. There's no reference to instructor...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Log File

    Ziljan4 (1/6/2008)


    Thank You again for clearing some misunderstandings.

    So, can I conclude that the only way to resolve the growing log is to take T log back up which truncates...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Date string in WHERE causes table scan instead of index seek

    Sergiy (1/5/2008)


    Steve,

    index on a column used in "range" selection ("BETWEEN", ">" or/and "<", TRANS_DATE in your case) must be clustered.

    Fix it and the SP will be always fast.

    I don't agree...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: Corporate Programming Sucks

    Loner (1/6/2008)


    My answer was restored the full backup from midnight, then restore the last transaction log. I guessed I was only half right?

    Since they didn't say about log backups,...

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • RE: stored proc

    Or databases per customer. I've seen that before. I haven't yet had the 'pleasure' of working on monthly databases.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 15 posts - 47,761 through 47,775 (of 49,552 total)