HiWe have a script that allows customers to change the users of thedatabase including the database owner. This script can be run at anytime. However, sometimes (and it really is only sometimes!) when thefollowing statement executes:"exec sp_changedbowner @USER_OWNER"the following error is reported:"The proposed new database owner is already a user in the database."I have checked the other postings and the Books Online but cannot finda way to query the current name of the dbowner i.e. the value of@USER_OWNER above. We have to be able to do this within the script sothat if the @USER_OWNER variable is already the dbowner we do notbother to execute the statement as otherwise this could display theerror. Can anybody help?Thanks in AdvancePaul
How do I change the Database owner for a MODEL database? When I open the properties for a Model database, it shows "UNKNOWN" as the database owner, and I can't run the command 'sp_changedbowner 'sa' as it's not allowed to run on master, model, and tempdb. Any help?
I have a user with DBOWNER,DBCREATOR role and access is set to deny on viewing any other databases. Now when I connect using this user and try to restore the database. after restore, I can not open it or access it using the same user. what is causing this. Thanks,
I have my program create and load (restore) a database, then create a login and make it dbowner by running a script like below via OSQL:
EXEC sp_addlinkedserver 'SETUP1myserver','SQL Server' EXEC sp_serveroption 'SETUP1myserver','DATA ACCESS', 'TRUE' GO DROP DATABASE [mydb] GO EXEC sp_droplogin 'mylogin' GO CREATE DATABASE [mydb] ON (NAME = N'mydb_data', FILENAME = N'C:AppfolderSQLmydb.mdf' , SIZE = 100, FILEGROWTH = 10%) LOG ON (NAME = N'mydb_log', FILENAME = N'C:AppfolderSQLmydb.ldf' , FILEGROWTH = 10%) COLLATE Latin1_General_CI_AS GO RESTORE DATABASE mydb FROM DISK = 'C:AppfolderSetupmydb.bak' WITH REPLACE, MOVE 'mydb_data' TO 'C:AppfolderSQLmydb.mdf', MOVE 'mydb_log' TO 'C:AppfolderSQLmydb.ldf' GO EXEC sp_addlogin 'mylogin','pass1$' GO USE mydb EXEC sp_changedbowner 'mylogin' GO
This works fine to a point. The program can then connect to the database and carry out normal processing with the "mylogin" user/password but it cannot do administration activities that a dbowner can do.
How do I create a login that does have true dbowner rights?
We ran into weird/interesting issue with below details.
Version: Microsoft SQL Server 2012 (SP1) - 11.0.3000.0 (X64) Standard Edition (64-bit) on Windows NT 6.2 <X64> (Build 9200):
We are using SQLCMD to run DDL script on our product database in below order. That script has below content.
step # 1 - database collation change (case -sensitive) statement as very first statement of the script step # 2 - Actual DDL SQL statements step # 3 - database collation change back to original (case insensitive)
When we execute all above 3 steps in single script using SQLCMD on our test_server#1 , it is successful but when same is being implemented on test_ server#2 , it is failing.We ensured that there is no other user accessing the db and setting on both the server are all default/basic. Separating out all 3 steps in 3 different script working fine. This is only problem when we combine them into single script and fire it using SQLCMD. If it is something related to session/transaction then we should hit same issue on our test_server#1 server as well but that is not the case.test_server#1 and test_server#2 has exact same database/data, just two different physical machine & SQL Server instance.
Actually i'm working with a pc named "my_pc", later i'll need to change its name to "my_server". Obviously MsSQLServer is afected due to it depends in the name of the pc, also the master database has all its configurations and aditional information related to the name "my_pc".
My question is: How can i do the change in MsSQLServer without reconstruncting the master database?
Can anyone help me on this problem please? When i use sql statement to pull out data, one of the fields will pull out data like 200 or 300 or sumthing like that. But now i need to pull out the data as 2.00 instead of 200. How do i do that? Thanx
i set the name of my ss to default on install, and now i want to use 'AttachDbFilename' to attach my dbfile in my asp.net app, but i cannot connect to the server. i fond in the adv. options, that the DataSource is set to '.SQLEXPRESS' which is not the name of my SS, but i can't change it, so i want to ask if i can change the name of my SS withou reinstall.
I have a web app, designed using VWD Express and using SQL 2005 Express. It has a mdf database called "client". It was created using security of windows authentication. I have already changed my instance of sql server express to accept mixed windows and sql authentication. How do I change my "client" database's permissions to the sql authentication? I need to add a user name and password as a requirement for my web host to be able to attach the mdf to their instance of sql 2005. It has to be the same user and password as I use with my web host's sql server 2005. Thank you in advance.
Hi All, Suppose I have created one table say "Customer" Customer (cust_no, cust_name,cust_address) I want to change the attribute name "cust_no" to "cust_number". How to do it using ALTER command. Pls give me the exact syntax for this.
When I try to execute a query and after 30 seconds the program sends me error : Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. Exception Detail: System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. Source error: Line 550 Dim myDataSet as Dataset = New DataSet Line 551 myDataSet = db.ExecuteDataSet(System.Data.CommanType.Text,NewSql) <== Error line Line 552 i=myDataSet.Tables(0).Rows.Count
In my connection string I set the parameter "Connection Timeout" = 360 but it not works. ( In debug mode the value for db.GetConnection.ConnectionTimeout is the same(360) like the parameter timeout connection.
After many searchs I found the default value for CommandTimeout is 30 secs. Can I change this value ?
Any suggestion will be welcome. I'm using FrameWork 1.1.
I was simply trying to create a sql command using ASP 2.0 but the syntax appears to have changed. I was trying to write the following: SqlCommand cmdUpdateData = new SqlCommand("AddMessage", myConnection); cmdUpdateData.CommandType = CommandType.StoredProcedure; But, intellisence will not offer me the second 'CommandType' on the second line?? It works fine using ASP 1.1 but not here on 2.0 Can anyone please help?
hi, I just imported my access database into sql server 2000 and apparently during this importation the owner was set to my name. This gives my a problem retrieving the data in asp.net though. I found out that the problem (System.Data.SqlClient.SqlException: Invalid object name 'tablename') is situated at this ownership by stripping the query to a bare minimum and trying it on a new table created in sql server with dbo as the owner. My problem now is that I can't seem to find the way to change the owner to dbo from 'peterj'. Can you help me on this one ??
I have one server out of 6 that lets me logon as SA with the default password of null. If I run this command to change the password I get password changed, but it did not change it, I still can logon as SA with the NULL password.
I have take courses in VB 6.0 and SQL 2000. My background is accounting and financal analysis. I would like to change my career to the IT field and be in a position to use my financial background to my advantage. any suggestions?
I have a few ASPs that were written to pull from an Access 97 database. Now that we have converted the data over to a SQL database, the ASPs have been changed accordingly. My problem is that I have two ASPs which use an Inner Join between three tables where the main field (in this case it is called "INDEX") is what the pull is based on. When I try to run the ASPs I recieve this error .
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'INDEX'.
The line that it identifies is where the connection is actually opened. This is only occuring on the ASPs that use the column INDEX and an inner join. The straight style number pulls (which have the same connection string) are working fine. Any ideas?
Is there a way in SS 7.0 to change ownership of an object from a user owned object to dbo owned object other than dropping the object and re-creating it? E.G. juser.table to dbo.table Thank you, GaetonC
We need to test a DTS package provided by a vendor. The DTS package imports data from flat files to a database. However, when I go in and change the DTS connection object for the database, it drops the data transformation properties. When I look at the properties it automatically points to the first (alphabetically speaking) table of our database. There is no way for me to verify that the mapping I am creating for these tables is accurate (and matches what the vendor had originally set). I am new to MS SQL and haven't found the answer ... any help would be appreciated!
The old administrator left and I am learning slowly. Since his password was changed, SQL cannot start. I get an error 1069 login failed. Maybe you have a good idead I haven't thought of?
I need to change server name on my WinNT Server. But if I change the server name on NT Server, SqlServer does not connect. Can I change registered server name on SQLServer ? What do I need to do ?
Hi all, There is a guy in my company install a sql server himself, but he picked the per seat license rather then the per server (we got the per server license), is there a way to change it without re-install the whole sql server? or need to reinstall from start? Thanks, Westley