Forum Replies Created

Viewing 15 posts - 2,641 through 2,655 (of 5,393 total)

  • RE: Try catch in a transaction block or transaction in try catch block???

    Mahesh Bote (9/23/2011)


    try this ...

    Begin Try

    Begin Tran

    Insert Into TableName Values (99, 'ZZZ');

    Update TableName

    SetColName = 'XXX'

    Where ColName = 99;

    Commit Tran

    End Try

    Begin Catch

    If @@Error <> 0

    Begin

    RollBack Tran

    End

    End Catch

    If you fall into the...

    -- Gianluca Sartori

  • RE: Cursor settings question

    Server side cursors are less memory demanding for the client, but need an extra round trip to the server avery time you need to fetch a row. If you have...

    -- Gianluca Sartori

  • RE: Try catch in a transaction block or transaction in try catch block???

    HowardW (9/23/2011)


    Hi Gianluca,

    Have a question about this code:

    IF @localTran = 1 AND XACT_STATE() = 1

    ROLLBACK TRAN

    Once you're in the catch block, wouldn't you want to roll back the...

    -- Gianluca Sartori

  • RE: Owned Schema

    This should help:

    SELECT sc.name AS schema_name,

    dbp.name AS owning_database_principal_name,

    srp.name AS owning_server_principal_name

    FROM sys.schemas AS sc

    INNER JOIN sys.database_principals AS dbp

    ON sc.principal_id = dbp.principal_id

    INNER JOIN sys.server_principals AS srp

    ON srp.sid = dbp.sid

    -- Gianluca Sartori

  • RE: Try catch in a transaction block or transaction in try catch block???

    You can use my stored procedure code template[/url] if you like it.

    It should do what you ask for.

    Regards

    Gianluca

    -- Gianluca Sartori

  • RE: what's the best column for clustered indexes

    You're not giving enough information to get sensible advice.

    First of all, give yourself a chance to get an answer and format the code you post. You can make it more...

    -- Gianluca Sartori

  • RE: SSRS report query problem

    I think it's a duplicate post to this one: http://www.sqlservercentral.com/Forums/FindPost1179871.aspx

    Or are you asking a different question?

    -- Gianluca Sartori

  • RE: Input Parameter Validation..

    I don't think I understand your question.

    If the stored procedure accepts a float parameter, you will pass float values.

    If you try to pass anything else, it will be converted explicitly...

    -- Gianluca Sartori

  • RE: help to format query using table alias

    Given that both queries return exactly one row, you have two options:

    1) Use variables:

    DECLARE @PreviousNAV decimal(21,6)

    DECLARE @TodaysNAV decimal(21,6)

    SELECT @PreviousNAV = ISNULL(@PreviousNAV,0) PreviousNAV

    FROM Fireball..NAV

    WHERE Date = @StartDate and PortfolioId = @PortfolioId

    SELECT...

    -- Gianluca Sartori

  • RE: Slow Cursor

    montyismobile (9/22/2011)


    Hi Gianluca Sartori,

    Thank you very much for your asistance with this, and so quickly too.

    I must thank you for an elegant looking solution. I am looking forward to...

    -- Gianluca Sartori

  • RE: Slow Cursor

    montyismobile (9/22/2011)


    Silly question. Is there an easy way for me to copy this code as it is formatted? When I copy and paste from the windo it all...

    -- Gianluca Sartori

  • RE: Slow Cursor

    OK, I think this should solve your issue:

    PLEASE read the code and try to understand it. If you don't understand it, DON'T use it, come back here and ask for...

    -- Gianluca Sartori

  • RE: Creating User with Admin Rights on only one database

    I'm sure there's a detailed installation guide shipped with SAP. Have you checked that?

    As far as the db_creator role, in SSMS, expand security/logins, right click the user and select "properties"....

    -- Gianluca Sartori

  • RE: Without enable login auditing may I know who has stopped the sql server agent service?

    forsqlserver (9/22/2011)


    I am not getting your reply, are u in my favor?

    I'm sorry, I see that my reply is confusing.

    I wanted to say that I have tried stopping/starting the...

    -- Gianluca Sartori

  • RE: UPDATE without listing all columns?

    I agree that this table should probably be re-designed.

    However, you can achieve what you're after by using a trigger INSTEAD OF INSERT, that could turn INSERTs into UPSERTs using the...

    -- Gianluca Sartori

Viewing 15 posts - 2,641 through 2,655 (of 5,393 total)