Forum Replies Created

Viewing 15 posts - 6,856 through 6,870 (of 14,953 total)

  • RE: Set row count with commit

    This is how I do that kind of thing:

    SELECT 1

    WHILE @@rowcount > 0

    DELETE TOP (10000) FROM table1;

    The initial "select 1" sets the @@rowcount to 1, then it keeps deleting as...

    - 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: TDE and Backup Compression

    Whoever is saying they're incompatible simply hasn't read the relevant data in BOL.

    Encrypted data compresses significantly less than equivalent unencrypted data. If transparent data encryption is used to encrypt an...

    - 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: sp_send_dbmail - dashes under column headers

    I looked for a way to do that years ago. Gave up on it. I find convering the recordset to HTML using the XML query method to be...

    - 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: Query cost = 150%

    Could be. I don't think I've ever used SQL on a single-core machine, so maybe that's why I'm used to seeing wrong numbers.

    - 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: Job Activity Monitor

    Is the SQL Agent service running?

    Do you have the necessary server-level permissions to view job data?

    - 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: Most problems can be solved without resorting to a cursor or while loop

    I'd keep at least the name in the dataset:

    SELECT *, loginproperty(name, 'passwordLastSetTime')

    FROM sys.sql_logins AS SL

    WHERE is_policy_checked = 1

    AND is_expiration_checked = 1

    ORDER BY name;

    - 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 array parameter to a StoredProc

    There are a couple of ways to do that in SQL 2005. The easiest is send a list of delimited values, and use a string-parsing routine to split 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: Incorrect Syntax near 'False'

    Write a dynamic SQL script that will allow you to do so. Here's a simple example:

    DECLARE @sql NVARCHAR(MAX);

    SELECT @sql = 'CREATE PROC Test1

    @StartDate DateTime = NULL,

    @EndDate DateTime = NULL

    AS

    BEGIN

    SET...

    - 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: Query cost = 150%

    When I open the plan, I get 11%, 39%, 25%, 1%, and 0%, for each sub-query, which adds up to 76%, which is obviously just as wrong, but in the...

    - 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: Incorrect Syntax near 'False'

    Then you'll need to use a different deployment method.

    I would generally not include the same proc in multiple databases. I have a database called "Common" where I store that...

    - 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: Inherited a bad designed database

    The normalized tables look okay.

    The way I usually do that kind of thing is use the Output clause to tie the ID values from the new tables back to the...

    - 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: Incorrect Syntax near 'False'

    It's probably a question of string building. False has single-quotes around it that are probably breaking the dynamic SQL.

    Try replacing that with a 0 (assuming it's a bit field),...

    - 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: Job Activity Monitor

    If I remember correctly, I solved that once by rebooting.

    - 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: Is the result of "Order By" for exact same values random?

    The problem isn't the Insert. It's the final Select.

    select * from #ordertest order by EffectiveDate, LoadOrder, WorkOrderNum

    should be:

    select * from #ordertest order by EffectiveDate, LoadOrder, WorkOrderNum, ID

    or:

    select...

    - 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: Are the posted questions getting worse?

    Now all we need is the orcish (Dark Speech) for "cursor"...

    - 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 - 6,856 through 6,870 (of 14,953 total)