Forum Replies Created

Viewing 15 posts - 13,426 through 13,440 (of 14,953 total)

  • RE: Execution plans different

    SQL Server queries are not "deterministic" in terms of their execution plans.

    First thing I'd do is rewrite that query a bit, then I'd worry about different execution plans AFTER I'd...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Find number of weekdays(Monday,Tuesday..) between two dates monthwise

    For accurate counts of weekdays, I HIGHLY recommend a calendar table. That way, you can include holidays, etc.

    create table Calendar (

    Date datetime primary key,

    constraint CK_Date_NoTime

    check (Date...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Sorting problem in SQL 2005

    Not precisely. Are you querying the view, or connecting the client directly to the view?

    If querying the view, yes, the Order By (or lack thereof) of the calling query...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Null inserts

    Welllllllll .... the post is certainly appropos of the title ....

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Stuck to using pivot table

    As always, I'm going to recommend not doing pivoting in the database. Let a front-end application do it for you. They're better at it. SQL Server Reporting...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Numeric vss Bigint

    I'd go with bigint rather than numeric for an ID column. If you somehow find you need more rows than bigint can deal with, you're probably better off with...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Sorting problem in SQL 2005

    Order By works in views in SQL 2005. Are you using column aliases in the Select clause? Do you have two columns in the view with the same...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Using MAX in SQL Server 2005

    Try these:

    ;with MaxRain (DT, MID, Rainfall) as -- Max Rainfall per Day

    (select date_taken, main_id, max(daily_rainfall)

    from dbo.SEL

    group by date_taken, main_id)

    select Date_Taken, Main_ID, Time, Rainfall

    from dbo.SEL

    inner join MaxRain

    on date_taken = dt

    and main_id...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: How Can Attach and Detach my MDf file Programatically or by T-SQL

    This is a duplicate thread. Thread of same name and question in Administering forum. Please don't double-post.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: create Trigger auto.

    I don't understand your request. Are you asking about a trigger for when you attach a database?

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Error !The INSERT statement conflicted with the FOREIGN KEY constraint

    The key to Michael's answer is "scope_identity()". Look at that one in Books Online. Very useful tool.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: How Can i Attach and Detach my MDf file Programatically or by T-SQL

    To attach a database, check out Create Database in Books Online. There's a "for attach" argument you can use.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: A Private Database

    Easily-managed row-level security would be nice. I've generally ended up using hierarchies of accounts for that kind of thing.

    I haven't dug into service broker at all. It's not...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: Audit Trails and Logging Part I

    margo (6/9/2008)


    A nice summary, always useful to check what we're doing with what others are saying.

    One thing I would add to the downside of "passive" audits... the cost of keeping...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • RE: SET STATISTICS TIME ON - how to read the results?

    CPU time is how much time was spent by the CPU (or CPUs). Total time is how long it took from start to finish.

    For example, if it takes 1...

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 15 posts - 13,426 through 13,440 (of 14,953 total)