Forum Replies Created

Viewing 15 posts - 646 through 660 (of 14,953 total)

  • RE: Adding record to db using stored procedure and identity counter.

    You can do something like this:

    SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;

    BEGIN TRANSACTION;

    DECLARE @NewVal BIGINT = (SELECT MAX(member_id) FROM dbo.member WITH (TABLOCKX))+1;

    INSERT INTO dbo.Member (member_id, column list)

    VALUES (@NewVal, @Params);

    COMMIT;

    Do it in one...

    - 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: ODBC connection and A Record

    It sounds good in theory, but I suggest trying it with a proof-of-concept test. Should be easy enough to test on a simple VM. Then you'll know for...

    - 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: getting rid of sort operation

    So far as I know, Group By will require a sort, since it has to put the rows together to do whatever aggregation you're asking for. You might 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 table with dynamic table name is it possible?

    Nope. SQL doesn't work that way.

    Look into sp_executeSQL for a better way to do this than EXEC(), but you'll need to use dynamic SQL for that kind of thing.

    - 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: Two Steps Ahead

    A disaster is an emergency you didn't anticipate.

    Good editorial. Anticipating and preventing problems is key to good DBA 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: Is there a Coalesce LIke function that returns the lowest/highest value of a set of params passed to it

    Another possible solution:

    USE ProofOfConcept;

    SET NOCOUNT ON;

    IF OBJECT_ID(N'tempdb..#T') IS NOT NULL

    DROP TABLE #T;

    CREATE TABLE #T

    (ID INT IDENTITY

    ...

    - 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: funky date/time stamp

    SELECT CAST(SUBSTRING(Col, 5, 6) + ',' + RIGHT(Col, 4) + ' ' + SUBSTRING(Col, 12, 8) AS DATETIME)

    FROM

    (VALUES

    ('Tue Jun 12 21:00:53 EDT 2012'),

    ('Tue Jun 12 22:20:51 BST 2012'),

    ('Wed...

    - 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: Production DBA Vs Project/Development DBA

    Have you asked for clarification from your employer as to what exactly they mean by the differentiation?

    Explain that "DBA", even with adjectives like "Production" or "Project/Development", is recognized as being...

    - 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: what is the Exec_context_ID in sys.dm_os_Tasks?

    Here's what MSDN says:

    Execution context identifier (ECID). The execution context ID of a given thread associated with a specific SPID.

    ECID = {0,1,2,3, ...n}, where 0 always represents the main or...

    - 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: Very Small Tables

    Nah. I wouldn't expect a lot of disagreement on this one. Indexing a 1-page table for something other than data integrity purposes, would be silly.

    - 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: insert data from file to sql table

    Insert it into a staging table first.

    Is there anything in the file that identifies the rows uniquely? Like a row number or anything like 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: SQL Server Consolidation (25 servers)

    There's a fair amount to consider when consolidating database servers. The two most important things are resource availability, and support issues.

    On resource availability, it's pretty obvious. If 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: Backup plan help required

    I may have missed something, but do all the Full backups have to be on the same day?

    You mention fortnightly Full backups. You can pile up a couple of...

    - 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: Index with Include

    The index suggestions do that kind of thing a lot.

    Go with the combined index, not two separate indexes that are so similar to each other.

    - 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: Very Small Tables

    For small enough tables, SQL Server will ignore indexes anyway, when creating execution plans, even if you do have them.

    If the table ends up growing enough to need one, 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

Viewing 15 posts - 646 through 660 (of 14,953 total)