Forum Replies Created

Viewing 15 posts - 5,011 through 5,025 (of 5,393 total)

  • RE: SQL SERVER SP to ORACLE

    I'm not aware of any tool able to convert your code from T-SQL to PL/SQL, I think you will have to do it manually.

    If such a tool existed, anyway, I...

    -- Gianluca Sartori

  • RE: HowTo use PIVOT on Select in SQL Server 2005

    You can't use parameters declared outside the dynamic statement in the statement itself. You have to declare the params in the appropriate argument of sp_executesql. Example:

    declare @sql nvarchar(4000)

    declare @value nvarchar(50)

    set...

    -- Gianluca Sartori

  • RE: Linked Server Performance and TempDB

    Uncle Moki (7/17/2009)


    won't that make the join results HUGE x n?

    No, if you just specify the columns you need. In that case results are smaller.

    Uncle Moki (7/17/2009)


    As for the joins:...

    -- Gianluca Sartori

  • RE: Tsql query help

    This is a simple way.

    UPDATE dbo_DimAddress

    SET city = replace(city, 'ã', 'a'),

    country = replace(country, 'ã', 'a'),

    state = replace(state, 'ã', 'a')

    WHERE city LIKE '%ã%'

    ...

    -- Gianluca Sartori

  • RE: Earch Table Size

    I don't remember where I got this script, probably from SSC...

    Here you are:

    declare @idint

    declare @typecharacter(2)

    declare@pagesint

    declare @dbname sysname

    declare @dbsize dec(15,0)

    declare @bytesperpagedec(15,0)

    declare @pagesperMBdec(15,0)

    create table #spt_space

    (

    objidint null,

    rowsint null,

    reserveddec(15) null,

    datadec(15) null,

    indexpdec(15) null,

    unuseddec(15) null

    )

    set...

    -- Gianluca Sartori

  • RE: Locking a stored procedure for updating/reading

    Invert SELECT and UPDATE: you don't lock the row just reading, you have to write to put a lock.

    BEGIN TRAN TestTran

    UPDATE TestTable

    SET ID =...

    -- Gianluca Sartori

  • RE: missing indexes

    I think that missing indexes coming from DMV are just a hint to report something can be improved, but I would never create the indexes exactly how the DMV suggests....

    -- Gianluca Sartori

  • RE: Having problem getting rid of index scan in procedure

    I'm sorry, I was referring to the original post 'cause I had no time to look at the revised one. It's very strange: yesterday I removed from your query all...

    -- Gianluca Sartori

  • RE: Ghost cleanup

    That process cannot be killed, it's a system process. I don't think that process prevents you from setting the DB in read only: I suggest you investigate further to find...

    -- Gianluca Sartori

  • RE: Linked Server Performance and TempDB

    Try this way:

    SELECT

    t.AccountNumber

    ,t.CustomerID AS LocalCustomerID

    ,c.CustomerID AS RemoteCustomerID

    ,t.AddressID AS LocalAddressID

    ,c.AddressID AS RemoteAddressID

    ,c.Address

    FROM

    dbo.MyAccounts AS t

    INNER JOIN OPENQUERY(MyLinkedServer,...

    -- Gianluca Sartori

  • RE: how to write query output into a text file?

    Select from the menu: Query, results to..., File.

    Ctrl+Shift+F is the shortcut for it.

    I think you picked the wrong post type anyway, this is not a poll.

    Regards

    Gianluca

    -- Gianluca Sartori

  • RE: Having problem getting rid of index scan in procedure

    WayneS (7/16/2009)


    I find this theory interesting, since the columns that are in the where clause are not in the tables that are producing scans.

    It doesn't matter, the optimizer can choose...

    -- Gianluca Sartori

  • RE: Having problem getting rid of index scan in procedure

    You can't. Or, at least, I don't know how you could.

    The scan is due to the OR to include NULL values for processed_flag and reviewed. Using ISNULL or COALESCE won't...

    -- Gianluca Sartori

  • RE: HowTo use PIVOT on Select in SQL Server 2005

    Graham.Irons (7/15/2009)


    However, there may be any number of Employees.

    This is one of the limitations of the PIVOT operator: it must have fixed pivoting values.

    In your case you may consider...

    -- Gianluca Sartori

  • RE: HowTo use PIVOT on Select in SQL Server 2005

    Graham.Irons (7/15/2009)


    I've not seen the use of # before.

    # denotes a temporary table, which I created in the DDL and test data script I posted earlier.

    Temporary tables are visible...

    -- Gianluca Sartori

Viewing 15 posts - 5,011 through 5,025 (of 5,393 total)