sql server 2008 db ownership question

Hi,

In my SQL Server 2008, there is a database DB1 which is a database restore 
from SQL Server 2000 .bak file.
In the SQL Server 2000, the DB1's owner is User1.  But when I restored the 
bak file to 2008, the 2008 doesn't have the user User1, so the default owner 
of the DB1 in 2008 is dbo.
I then added the User1 and changed the DB1's ownership to User1, and all the 
Tables under DB1 looks like the form of User1.Table
However, in my query script, I have to type
SELECT * FROM User1.Table
If I just type
SELECT * FROM Table
it won't work.
How do I fix this problem?
Thanks for help.


Jason 


0
Jason
4/12/2010 6:38:45 AM
sqlserver.server 1327 articles. 0 followers. Follow

5 Replies
262 Views

Similar Articles

[PageSpeed] 38

Jason
That exactly the reason why MS introduce it. If you have a schema why would 
you abandon it?
Add User1 to be member of sysadmin role (do you really needed it?) and then 
you can write SELECT * FROM Table



"Jason Huang" <JasonHuang8888@hotmail.com> wrote in message 
news:e$swXrg2KHA.4716@TK2MSFTNGP06.phx.gbl...
> Hi,
>
> In my SQL Server 2008, there is a database DB1 which is a database restore 
> from SQL Server 2000 .bak file.
> In the SQL Server 2000, the DB1's owner is User1.  But when I restored the 
> bak file to 2008, the 2008 doesn't have the user User1, so the default 
> owner of the DB1 in 2008 is dbo.
> I then added the User1 and changed the DB1's ownership to User1, and all 
> the Tables under DB1 looks like the form of User1.Table
> However, in my query script, I have to type
> SELECT * FROM User1.Table
> If I just type
> SELECT * FROM Table
> it won't work.
> How do I fix this problem?
> Thanks for help.
>
>
> Jason
> 


0
Uri
4/12/2010 9:22:41 AM
Thanks Uri!
The reason that I have to have the User1 to use the SELECT * FROM Table is 
in our front end, there are quite a few codes like that format.
And the User1 is the member of sysadmin role already.  I added some 
db_owner, db_accessadmin db role to User1.
But still can't directy use the SELECT * FROM Table.
In the Login property of the User1, the memember role mapping for DB1 is 
dbo, I'm not sure if this is correct.






"Uri Dimant" <urid@iscar.co.il> ���g��l��s�D:ei4%23RGi2KHA.3568@TK2MSFTNGP04.phx.gbl...
> Jason
> That exactly the reason why MS introduce it. If you have a schema why 
> would you abandon it?
> Add User1 to be member of sysadmin role (do you really needed it?) and 
> then you can write SELECT * FROM Table
>
>
>
> "Jason Huang" <JasonHuang8888@hotmail.com> wrote in message 
> news:e$swXrg2KHA.4716@TK2MSFTNGP06.phx.gbl...
>> Hi,
>>
>> In my SQL Server 2008, there is a database DB1 which is a database 
>> restore from SQL Server 2000 .bak file.
>> In the SQL Server 2000, the DB1's owner is User1.  But when I restored 
>> the bak file to 2008, the 2008 doesn't have the user User1, so the 
>> default owner of the DB1 in 2008 is dbo.
>> I then added the User1 and changed the DB1's ownership to User1, and all 
>> the Tables under DB1 looks like the form of User1.Table
>> However, in my query script, I have to type
>> SELECT * FROM User1.Table
>> If I just type
>> SELECT * FROM Table
>> it won't work.
>> How do I fix this problem?
>> Thanks for help.
>>
>>
>> Jason
>>
>
> 


0
Jason
4/13/2010 1:35:23 AM
Jason
If he/she is a member of sysadmin server role  it should work.Make sure that 
you connected as User1

"Jason Huang" <JasonHuang8888@hotmail.com> wrote in message 
news:uDzmUmq2KHA.556@TK2MSFTNGP04.phx.gbl...
> Thanks Uri!
> The reason that I have to have the User1 to use the SELECT * FROM Table is 
> in our front end, there are quite a few codes like that format.
> And the User1 is the member of sysadmin role already.  I added some 
> db_owner, db_accessadmin db role to User1.
> But still can't directy use the SELECT * FROM Table.
> In the Login property of the User1, the memember role mapping for DB1 is 
> dbo, I'm not sure if this is correct.
>
>
>
>
>
>
> "Uri Dimant" <urid@iscar.co.il> 
> ���g��l��s�D:ei4%23RGi2KHA.3568@TK2MSFTNGP04.phx.gbl...
>> Jason
>> That exactly the reason why MS introduce it. If you have a schema why 
>> would you abandon it?
>> Add User1 to be member of sysadmin role (do you really needed it?) and 
>> then you can write SELECT * FROM Table
>>
>>
>>
>> "Jason Huang" <JasonHuang8888@hotmail.com> wrote in message 
>> news:e$swXrg2KHA.4716@TK2MSFTNGP06.phx.gbl...
>>> Hi,
>>>
>>> In my SQL Server 2008, there is a database DB1 which is a database 
>>> restore from SQL Server 2000 .bak file.
>>> In the SQL Server 2000, the DB1's owner is User1.  But when I restored 
>>> the bak file to 2008, the 2008 doesn't have the user User1, so the 
>>> default owner of the DB1 in 2008 is dbo.
>>> I then added the User1 and changed the DB1's ownership to User1, and all 
>>> the Tables under DB1 looks like the form of User1.Table
>>> However, in my query script, I have to type
>>> SELECT * FROM User1.Table
>>> If I just type
>>> SELECT * FROM Table
>>> it won't work.
>>> How do I fix this problem?
>>> Thanks for help.
>>>
>>>
>>> Jason
>>>
>>
>>
>
> 


0
Uri
4/13/2010 6:37:58 AM
If the object exists in schema "User1" and you don't want to schema-qualify 
then you have to set the default schema for the user you connect as to 
"User1".

-- 
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi



"Jason Huang" <JasonHuang8888@hotmail.com> wrote in message 
news:uDzmUmq2KHA.556@TK2MSFTNGP04.phx.gbl...
> Thanks Uri!
> The reason that I have to have the User1 to use the SELECT * FROM Table is 
> in our front end, there are quite a few codes like that format.
> And the User1 is the member of sysadmin role already.  I added some 
> db_owner, db_accessadmin db role to User1.
> But still can't directy use the SELECT * FROM Table.
> In the Login property of the User1, the memember role mapping for DB1 is 
> dbo, I'm not sure if this is correct.
>
>
>
>
>
>
> "Uri Dimant" <urid@iscar.co.il> 
> ���g��l��s�D:ei4%23RGi2KHA.3568@TK2MSFTNGP04.phx.gbl...
>> Jason
>> That exactly the reason why MS introduce it. If you have a schema why 
>> would you abandon it?
>> Add User1 to be member of sysadmin role (do you really needed it?) and 
>> then you can write SELECT * FROM Table
>>
>>
>>
>> "Jason Huang" <JasonHuang8888@hotmail.com> wrote in message 
>> news:e$swXrg2KHA.4716@TK2MSFTNGP06.phx.gbl...
>>> Hi,
>>>
>>> In my SQL Server 2008, there is a database DB1 which is a database 
>>> restore from SQL Server 2000 .bak file.
>>> In the SQL Server 2000, the DB1's owner is User1.  But when I restored 
>>> the bak file to 2008, the 2008 doesn't have the user User1, so the 
>>> default owner of the DB1 in 2008 is dbo.
>>> I then added the User1 and changed the DB1's ownership to User1, and all 
>>> the Tables under DB1 looks like the form of User1.Table
>>> However, in my query script, I have to type
>>> SELECT * FROM User1.Table
>>> If I just type
>>> SELECT * FROM Table
>>> it won't work.
>>> How do I fix this problem?
>>> Thanks for help.
>>>
>>>
>>> Jason
>>>
>>
>>
>
> 
0
Tibor
4/13/2010 10:27:46 AM
Thanks!
I finally tried the sp_change_users_login UPDATE_ONE, 'User1', 'User1'.
Then I can do the SELECT * FROM Table.

"Tibor Karaszi" <tibor_please.no.email_karaszi@hotmail.nomail.com> 
???????:efaV2Pv2KHA.5004@TK2MSFTNGP04.phx.gbl...
> If the object exists in schema "User1" and you don't want to 
> schema-qualify then you have to set the default schema for the user you 
> connect as to "User1".
>
> -- 
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
>
>
> "Jason Huang" <JasonHuang8888@hotmail.com> wrote in message 
> news:uDzmUmq2KHA.556@TK2MSFTNGP04.phx.gbl...
>> Thanks Uri!
>> The reason that I have to have the User1 to use the SELECT * FROM Table 
>> is in our front end, there are quite a few codes like that format.
>> And the User1 is the member of sysadmin role already.  I added some 
>> db_owner, db_accessadmin db role to User1.
>> But still can't directy use the SELECT * FROM Table.
>> In the Login property of the User1, the memember role mapping for DB1 is 
>> dbo, I'm not sure if this is correct.
>>
>>
>>
>>
>>
>>
>> "Uri Dimant" <urid@iscar.co.il> 
>> ���g��l��s�D:ei4%23RGi2KHA.3568@TK2MSFTNGP04.phx.gbl...
>>> Jason
>>> That exactly the reason why MS introduce it. If you have a schema why 
>>> would you abandon it?
>>> Add User1 to be member of sysadmin role (do you really needed it?) and 
>>> then you can write SELECT * FROM Table
>>>
>>>
>>>
>>> "Jason Huang" <JasonHuang8888@hotmail.com> wrote in message 
>>> news:e$swXrg2KHA.4716@TK2MSFTNGP06.phx.gbl...
>>>> Hi,
>>>>
>>>> In my SQL Server 2008, there is a database DB1 which is a database 
>>>> restore from SQL Server 2000 .bak file.
>>>> In the SQL Server 2000, the DB1's owner is User1.  But when I restored 
>>>> the bak file to 2008, the 2008 doesn't have the user User1, so the 
>>>> default owner of the DB1 in 2008 is dbo.
>>>> I then added the User1 and changed the DB1's ownership to User1, and 
>>>> all the Tables under DB1 looks like the form of User1.Table
>>>> However, in my query script, I have to type
>>>> SELECT * FROM User1.Table
>>>> If I just type
>>>> SELECT * FROM Table
>>>> it won't work.
>>>> How do I fix this problem?
>>>> Thanks for help.
>>>>
>>>>
>>>> Jason
>>>>
>>>
>>>
>>
>> 


0
Jason
4/19/2010 12:26:51 AM
Reply:

Similar Artilces:

Calling Dex Procedures from SQL
Is there any way to call dex procs from SQL or VB code? Jed There is an undocumented and unsupported method of calling Dex code from VBA. However, I know of no method of calling Dexterity from SQL. Please email me if you want an example, just remove the online. from the address below. David Musgrave [MSFT] Senior Development Consultant MBS Services - Asia Pacific Microsoft Business Solutions http://www.microsoft.com/BusinessSolutions mailto:dmusgrav@online.microsoft.com Any views contained within are my personal views and not necessarily Microsoft Business Solutions policy. This p...

is SQL 2000 architecture different SQL Server 2005 / 2008 architecture?
Hi I have a book "inside SQL Server 2000" by Kalen Delaney, which I have been told is a good book. I am going backwards... reading about the sql server architecture in chapter 3 of the book. As I'm reading... I was wondering is it different SQL Server 2000 vs SQL Server 2005/2008? Also where can I find a book/or link that can give me more details about the internals on architecture? Thank you norm (normanchan@gmail.com) writes: > Hi I have a book "inside SQL Server 2000" by Kalen Delaney, which I > have been told is a good book. I am g...

Moving customizations from SQL 2k to SQL 2k5 CRM
This may be a non-issue but I wanted to check to see if anyone has done this and ran into issues. I have the XML customization files from our previous install of CRM 3.0 with SQL 2k database. I now want to import and publish these same customizations to CRM 3.0 on SQL 2k5. Has anyone done this or can point me to documentation that tells about the success or issues for doing this? Thanks. On 7 Feb., 06:35, Chris Treanor <ChrisTrea...@discussions.microsoft.com> wrote: > This may be a non-issue but I wanted to check to see if anyone has done this > and ran into issues. > &...

OWA 2003 questions
Hi Before i was using Exchange 2000, since I've made the upgrade to Exchange 2003 when I go to the OWA 2003 web site I have this message after my credentials has been entered. This page contains both secure and non-secure items. Do you want to display the non secure items. After that message the padlock at the bottom of the screen disapears. This is not seems good to me When I was on Exchange 2000 I didn't have this message Thanks Are you using OWA with our without SSL? If you are trying to use it with SSL you will need to have a certificate authority setup in your doma...

Cannot install the 3rd Exchange 2003 Server
Hi All, Please help me. I cannot install the 3rd exchange Server 2003 on windows server 2003 Std with SP1 and without SP1. My AD is Server 2003 with SP1. The other 2 Exchange Server is 2003 std with SP2. During installing a new Exchange computer into the organization, I receive the following error message: Setup failed while installing sub-component Site Replication Service with error code 0xC007054B (please consult the installation logs for a detailed description). You may cancel the installation or try the failed step again. And the log is have the following error: [19:50:13] DS or RPC is b...

CRM 3.0 Install Error with SQL Reporting Services and SQL 2005
Hi, Doing a CRM 3.0 Server installation. During the last page of the install wizard (or what I assume is the last page) when I goes through and does verification I get a red X next to SQL Reporting Services. The message I receive when I look at the details is: ***** The specified path is not a metabase path. Parameter name: path ***** Now SRS is installed and working. I put in the URL: http://<servername>/reportserver and every other variation on that I can find. Thoughts? Alan try http://servername/reports also assuming you did not use ssl... =======================...

SQL 'for xml' and C# example??
I'm missing some piece of the puzzle. I'm using 'for xml' type queries from SQL2K - and now trying to change the front-end from ADO to C#, I can't quite figure it out.. It seems that I could use an XmlReader.. and somehow use that instead of a DataReader.. but that didn't work.. I tried using a DataReader and get the byte array - but that wasn't right. SQL returns formatted XML, I need to load that XML into an XmlDocument somehow without ANY molestation of that dom. Any ideas? Examples? Missing links???? thanks THANKS!! I've been looking for the answer to ...

Computerworld article on Mac Office 2008
Computerworld has a story giving a preview of Mac Office 2008. They have quotes from some key people at Microsoft who were involved in Mac Office 2008's development. The story can be read at this link: http://tinyurl.com/3be8p6 ...

thread question #4
How can I determine in a block of code if the thread it's running in is the same as the main GUI thread? I was trying to use GetCurrentThread to get the thread the function is being called from. Not sure how compare that to GUI thread. On Wed, 21 Dec 2005 13:58:35 -0600, "Eric Margheim" <NOSPAM***eric@prism-grp.com***NOSPAM> wrote: >How can I determine in a block of code if the thread it's running in is the >same as the main GUI thread? > >I was trying to use GetCurrentThread to get the thread the function is being >called from. Not sure how...

sql summarizing help
Hi All, Given: table1 --------- id, cdate, weeksago, amount, typeid, timeclose 496, 2010-02-11, 0, 450, 3, 1 490, 2010-02-01, 1, 200, 4, 1 491, 2010-02-01, 1, 350, 2, 2 493, 2010-02-01, 1, 500, 5, 1 489, 2010-01-21, 3, 150, 2, 1 136, 2010-01-12, 4, 500, 3, 2 137, 2010-01-12, 4, 100, 3, 1 138, 2010-01-12, 4, 500, 2, 1 1. i'm trying to create a sql that will give me a summary resultset grouped by weeksago. 2. i want to sum the columns and get counts based on typeid. 3. avg of timeclose here's the sql i have: select weeksago, , (sum(timeClose)/(count(timeclo...

Stupid question, I know
I feel like an idiot for even having to ask but I haven't been able to find a definitive answer anywhere. When building a new Exchange Server, do you need both an O/S (Windows Server 2003) and Exchange Server (Standard or Enterprise) Edition on the server or does the Exchange Server 2003 serve as the O/S? Let the comments begin.... You need Windows Server 2003 or 2000. Now if you purchase SBS 2003 then Exchange comes as part of the SBS Suite of applications but all applications must be run from the SBS Server. -- John Oliver, Jr MCSE, MCT, CCNA Exchange MVP 2006 Microsoft Certified ...

Project Server Cube Build Issue
I think I screwed up the install order on the SQL DMO components. According to MSDN: " At this time, do not use the feature packs for SQL Server 2008 to install and download these components, as those files will not allow you to build cubes in SQL Server 2008 Analysis Services with Project Server 2007." However, I didn't read that carefully enough and installed the Microsoft SQL Server 2008 Management Objects Collection instead of the 2005 version. Now I can't install the 2005 version even if I uninstall the 2008 version. The setup fails with the "highe...

Update multivalue field in table from form with SQL
Access 2007 on Vista I am using a form to establish the variables for a report before it is created. One field on the underlying table is a multivalue field, and the form includes a multi-select combo box control. After selections are made and the OK button on the multi-select combo drop down is clicked, focus moves to the next control. I have discovered though, that the underlying table does not update immediately, but does so correctly when I close the form. This sequence does not deliver the proper report data, so I need a way to immediately update the underlying table (m...

Refer to SQL statements globally
I have two large SQL statements that I need to use across several forms, reports, etc. Rather than repeat them in each form, I'm trying to store and reference them globally. For example, I'd like to store strSQL1 and strSQL2 in a global module, so I can use either like this in a form: Random form: Me!lstResults.RowSource = strSQL1 Random report: Me.Report.RecordSource = strSQL2 Would I just store the SQL statements in a global module like: Public Function SQLSource() As String Dim strSQL1 As String Dim strSQL2 As String strSQL1 = "SELECT blah blah...

WSUS 3.0 on SBS 2008 Best Practise
Is there any way to get the WSUS 3.0 databse on SBS 2008 to just contain updates that are required? When I install WSUS 3.0 on SBS 2008 I find myself having to decline thousands of un approved updates just to get WSUS 3.0 to a point where it only show updates that require approval for the machines on the SBS 2008 domain. I`d like if WSUs 3.0 only displayed updates that require approval. any suggestions gladly welcome. thanks, This is a multi-part message in MIME format. ------=_NextPart_000_004F_01CAE77F.3B3AE9E0 Content-Type: text/plain; charset="UTF-8"...

Questions #7
Please can anyone help me with a couple of questions I have about am Excel XP spreadsheet I have devised to pass out to other people. 1. I have a graphic on the spreadsheet which I want to make 'delete proof' I have used cell protection and a pass work to protect the sheet, but the graphic is still removeable, is there a cure for this? 2. On the sheet is a graph, the graph itself needs to be protected, but the titles could do with being editable, or linkable to another cell (in a seperate data sheet) that the user could edit to change the titles. I'm not a stranger to VBA, ...

To SQL or not to SQL?
I have a very vertical product developed 100% in M/S Access. I developed it myself in 1993 in the initial release of Access and been with it ever since. It is currently very stable and running in Access 2003. My big question is how or even *if* we should move it to SQL. My customers are getting bigger all the time with more users. Typically our customers run one or two workstations generally never more than 5. Performance, however, is starting to slow with database sizes passing 500 meg. We also have a LOT of code behind forms so are bound tightly to the Access development environ...

very general mail question
Hi, I just tried to send an e-mail after copying and pasting the e-mail address from a Contact (from Outlook 2007, Vista Home Premium, SP1). The message could not be sent. There were no error messages and I had no idea why this message could not be sent. For some reason the address was enclosed with single apostrophes ..... 'name@something.com' I tried copying the same e-mail address again and this time those apostrophes did not appear and the message was in fact sent. As a test I tried sending my self a message by enclosing my own valid e-mail address with enclosed with si...

writeback to SQL 2005
hello! I use excel 2007 iI open a connection agianst SQL server 2005 and choose a table. In my workbook i can now see this data from this table. if i change a value in some cell i wish to writeback to table in SQL server. Is this possible? It's possible through the use of VBA and ADO, but not simply using the data connection you've already established. Ross "CJ" <CJ@discussions.microsoft.com> wrote in message news:D54EC521-0DD5-4B3D-971B-4FF3394D6FA8@microsoft.com... > hello! I use excel 2007 > iI open a connection agianst SQL server 2005 and choose a table...

Server
Working in a large office we have recently replaced our exchange server. The new server has a different name fom the old one. For the vast majority of users this has not caused a problem. One user about once a week cannot open hois Outlook and the server name reverts back to the old server name. Please help ! ...

Can someone tell me some newsgroup server about AI or datamining?
Hi, all I am sorry to post my question here, but i really need help from everyone here. I have googled for newsgroup talking about AI or dataming for a long time, however, it ends no result. Can someone show me any newsgroup servers just like msnews.microsoft.com, then I would post my question there and gather helps from those experts. Best wishes Hi, there are endless resources in the internet, you just have to look for the right words and places: http://aima.cs.berkeley.edu/ http://dir.yahoo.com/Science/computer_science/artificial_intelligence/ http://en.wikipedia.org/wiki/Artif...

Project Server 2007 Hotfix dated 2/23/10
Need help in trying to determine what is actually being fixed in the newest hotfix they are the following first and second items in the kb article. Also, could someone let me know what the note applies to as well (that is the first item or the second item or both). Thanks!!!! 1. You accept updates for assignments in Microsoft Office Project 2007. In this case, the values for actual work and for actual overtime work differ from the values submitted by the resources. When you save and then publish the project, the resource timesheet on the My Tasks page shows the same incorrect...

MDI, beginner questions
Im trying to find the best way for me to implement multiple mdi child windows with dialog layout. My application will need several dialog windows with different layout (sort of like photoshops toolbar windows). All windows will only occur once so there is no need for any new/open/save functionality. I only need MDI to keep all windows organized. Could someone please help me with a simple code example? I've read a bunch of usenet posts, but I still can't figure out a suitable approach for my type of app. Thanks! Fredrik wrote: > Im trying to find the best way for me to implement ...

Outlook access to mail servers blocked
For last two days I suddently been unable to down load any email via either my talk tal broadband or my vodaphone mobile connection the message i get is the same across 5 different POP3 servers Receiving' reported error (0x80042108) : 'Outlook is unable to connect to your incoming (POP3) e-mail server. If you continue to receive this message, contact your server administrator or Internet service provider (ISP).' past post suggest the firewalls but had tried disabling them and its still the same - i know there is mail as i have it on my balckberry account - any ideas folks? I am r...

Question about antivirus for Exchange 2003
I currently use Mcafee groupshield for exchange 5.5 and while it does block infected attachments, it still sends the email message to the user which generates alot of complaints. I am ugrading to Exchange 2003 and this time I want to get something that is a little more flexible and can block not only the attachment, but the message too. I will look into the latest Mcafee solution, but wanted to hear about the experiences of others on this NG. Thanks NH Hi Ned, I'm using McAfee GroupShield for Exchange 2003. For your information, the software still behave exactly as you mentioned in...