Forum Replies Created

Viewing 15 posts - 13,951 through 13,965 (of 14,953 total)

  • RE: best way to remove duplicates when no primary key or date present

    The only actual duplicates I see are:

    insert into SC values ('k','22222','N/A')

    insert into SC values ('k','22222','N/A')

    RBarry's method will handle those two. The rest aren't strict duplicates. If you want...

    - 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: Data type error in view expression

    You'll have to have single-quotes around it.

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

    The problem is the Inner Join to Profiles.

    Try this:

    ;WITH CTE (RequestMonth, HoursRequested, HoursWorked) as

    (SELECT datepart(month, TimeOffRequests.FromDate),

    TimeOffRequests.Hours, Profiles.HoursWorkedInDay

    FROM dbo.TimeOffRequests

    INNER JOIN dbo.Profiles

    ON TimeOffRequests.UserID = Profiles.UserID

    WHERE Profiles.ReportsTo = @managerUserid

    AND TimeOffRequests.Status = @status

    AND...

    - 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: Indexes & tuning

    If a table has less than 200 rows, SQL Server won't even use non-clustered indexes.

    - 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: Poor Performance with Views

    sp_recompile doesn't actually affect views directly. Per Books Online, "Is the qualified or unqualified name of a stored procedure, trigger, table, or view in the current database. object is...

    - 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: passing parameters to function w/ inner join

    You might also want to change:

    set @LatCalc=(@Radius/69)

    set @LngCalc=(@Radius/69)

    to:

    set @LatCalc=abs(@Radius/69)

    set @LngCalc=abs(@Radius/69)

    That way, if someone accidentally enters a negative value for the radius, it will still work. Kind of paranoid, but...

    - 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: passing parameters to function w/ inner join

    Change:

    declare @LatCalc int

    declare @LngCalc int

    to:

    declare @LatCalc float

    declare @LngCalc float

    See if that fixes it for you.

    - 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: passing parameters to function w/ inner join

    Should have Okeana, OH for that Zip code. There are approx 300 Zip codes within approx 50 miles of that Zip.

    (Edit: Took less than 1 ms of CPU time,...

    - 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: Date Addition

    Jeff Moden recently posted an article on the front page of this site about calculating running totals. That should give you what you need.

    - 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: Table Constraints

    That looks like it should work.

    - 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: Usage of Functions in Stored Procedures

    Matt Minnis (4/29/2008)


    What about matrix type calculations?

    How can they be accelerated?

    What I mean is you have a bunch (about a dozen) of tables with charts of tax rates,freight rates, etc.

    Each...

    - 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: Usage of Functions in Stored Procedures

    d_sysuk (4/29/2008)


    There is a more subtle point, Im making in the query plan optimisation that is saved.

    A greater man, than I has quite nicely explained this , have a quick...

    - 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: Foreign Reference with another database

    A check constraint will work. There are also ways to solve this with a trigger.

    You might want to test a few options on both of those concepts and see...

    - 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: Column Level Synonym

    Per Books Online, synonyms can be created for:

    Assembly (CLR) Stored Procedure

    Assembly (CLR) Table-valued Function

    Assembly (CLR) Scalar Function

    Assembly Aggregate (CLR) Aggregate Functions

    Replication-filter-procedure

    Extended Stored Procedure

    SQL Scalar Function

    SQL Table-valued Function

    SQL Inline-table-valued Function

    SQL Stored...

    - 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: passing parameters to function w/ inner join

    Gail, the query you had joins on the Zip code columns. That's what's causing the problem. That, all by itself, eliminates all other Zip codes.

    - 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,951 through 13,965 (of 14,953 total)