sp_changeobjectowner: help required

  • Hi there

    I am new to this forum and also new to some aspects of SQL Server 2000.

    My problem is this. I can import tables from MS Access into SQL Server 2000 but the "owner" shows up as my login to SQL Server.

    I need to be able to change the owner from my login to "dbo". A quick search of the archives came up with the "sp_changeobjectowner" but I have no idea how to write the stored procedure associated with this.

    If for example I have a table that I have imported into SQL Server named "Test" (no permissions set yet) how do I write the stored procedure to change the owner from my login to dbo?

    Thanks for any help

    Jools

  • EXEC sp_changeobjectowner 'you.test', 'dbo'

    or

    EXEC sp_changeobjectowner 'test', 'dbo'

     



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

  • FYI, you can get questions like that answered more conveniently and timely for yourself in the future using SQL Server Books Online (BOL). From Enterprise Manager or Query Analyzer just press F1 (or access via Start Menu). I spend most of my time at the Index tab. For example, since you know the name of the command (a system stored procedure in this case) you can switch to Index mode and type "sp_chanageob" and it will jump to the listing for this SP. BOL is very nicely detailed. I have to give Microsoft a lot of credit there.

  • Thank you folks

    Placed the above script into Query Analyser and worked a treat!

    Most appreciated

    Jools

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply