January 5, 2016 at 11:48 pm
How can i change the owner of sql database when i don't have the SSMS to work with
January 6, 2016 at 1:19 am
You can try from SQLCMD.
Thank You.
Regards,
Raghavender Chavva
January 6, 2016 at 1:20 am
have to put ownerchanged query over sqlcmd?
January 6, 2016 at 1:22 am
sqlcmd -S instancename -q "SELECT * FROM AdventureWorks2012.Person.Person"
Thank You.
Regards,
Raghavender Chavva
January 6, 2016 at 1:26 am
You can use EXEC sp_changedbowner to change the ownership.
(In fact, that is probably exactly what the SSMS UI does when you click those buttons).
January 6, 2016 at 1:31 am
sqlcmd is shutting down after about 10 sec and not allowing me to write command
January 6, 2016 at 2:05 am
Write the sqlcmd command on notepad and paste it in cmd.... Try in this way
Thank You.
Regards,
Raghavender Chavva
January 6, 2016 at 2:08 am
If you just used copy/paste on what Raghavender posted, then you told the SQLCmd tool to execute a single query (listing all data from one of the AdventureWorks tables) and then exit.
Either replace that query with your own, or (my preference) connect with the correct options to give you an interactive window where you can type and execute queries.
Check Books Online for a full description of all command-line options for sqlcmd.exe.
January 6, 2016 at 9:40 pm
you can also use ALTER AUTHORIZATION
ALTER AUTHORIZATION ON DATABASE::MyDatabaseName TO NewOwner;
GO
or alternately use sp_changedbowner statement
January 9, 2016 at 7:38 am
Thanks A lot every one
I have found the solution
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply