Forum Replies Created

Viewing 15 posts - 1,936 through 1,950 (of 8,416 total)

  • RE: How to know who has created a temporary table in tempdb?

    SELECT

    SUSER_NAME(CONVERT(INTEGER, OBJECTPROPERTYEX(t.object_id, 'OwnerId')))

    FROM tempdb.sys.tables AS t

    WHERE

    t.name LIKE N'#banana%';

    ...assuming you were looking for temporary tables named '#banana'.

  • RE: Update/Insert/Merge Query

    This can be done in one MERGE statement, and yes there is a way to return the modifications made:

    DECLARE @Changes TABLE

    (

    account_idINTEGER PRIMARY KEY,

    the_addressNVARCHAR(100) NOT NULL

    );

    DECLARE @data TABLE

    (

    account_idINTEGER NOT...

  • RE: Check Table Exists being skipped in SP

    There's no need for the transaction or separate insert/delete operation, and the identity issue can be resolved by using a SET option:

    IFOBJECT_ID(N'dbo.pArchiveLogs', N'P')

    IS NULL

    EXECUTE ('CREATE PROCEDURE dbo.pArchiveLogs AS');

    ALTER PROCEDURE dbo.pArchiveLogs

    (

    @Days...

  • RE: Determine DB Recovery Model withing Sproc

    SELECT DATABASEPROPERTYEX(DB_NAME(), 'Recovery')

  • RE: greater than equal

    Unfortunately, no. Not much of the internal workings of the optimizer get documented - I guess part of the reason for that is that future changes would involve a...

  • RE: greater than equal

    cpreager (6/29/2011)


    So I think it could be an anomoly of the optimization, given I can't repeat the performance improvement in simpler conditions.

    The optimizer does contain rules that match on >=...

  • RE: Not able to drop Non-clustrered Index

    ananda.murugesan (6/29/2011)


    By default AUTO_CREATE_STATISTICS ON in SQL 2008 version, please tell me, why it was off?

    No idea - it seems likely it was done manually...?

  • RE: Listing results in a single column

    opc.three (6/28/2011)


    dbo.GROUP_CONCAT(i.OffID) AS offidlist

    Wouldn't that require the sorted variant to be strictly the same as the FOR XML example?

    Also, I don't want to discourage you, but that is very much...

  • RE: Converting a string to Time format

    There's no easy built-in way. You could:

    (1) Re-import the data from its source in a consistent format recognizable as a time by SQL Server, and store it in a...

  • RE: Updating multiple records in a single column

    The cause of the error is pretty self-evident, so I won't labour that point. Using the MERGE syntax may help you write the query more naturally, and make it...

  • RE: Not able to drop Non-clustrered Index

    This should help:

    USE [TELEDATA]

    GO

    -- Allow SQL Server to create missing statistics automatically

    ALTER DATABASE TELEDATA SET AUTO_CREATE_STATISTICS ON;

    GO

    -- Index to help the specific query below

    CREATE NONCLUSTERED INDEX [IX dbo.TEL_TXT_LI_ST site (a)]

    ON...

  • RE: Fastest way to 1,000,000 individual DML operations for Change Tracking

    wiseguy (6/27/2011)


    It is interesting to note: the execution plan shows a CLUSTERED INDEX UPDATE to the base table - even though I'm not updating the clustered index. Any idea...

  • RE: Not able to drop Non-clustrered Index

    It looks like someone created those indexes using the Management Studio templates and included the data type definition my mistake! You will need to enclose the index name in...

  • RE: Trying to capture no record inserted.

    The following example shows your code rewritten to use appropriate types and to be robust under high concurrency conditions. The return code from the procedure is the number of...

  • RE: greater than equal

    Jayanth_Kurup (6/28/2011)


    I found the below article on the usage of greater than vs greater than or equal to

    http://www.lcard.ru/~nail/sybase/perf/18295.htm

    The logic seems sound but i doubt if i will consider it...

Viewing 15 posts - 1,936 through 1,950 (of 8,416 total)