Hi, Charles,
thanks for the quick reply.
To this post I added the file "init-db.sql" (hope it arrives). The script
can be used to create a little test-database. You can change the values of
the variables at the beginning if you want. I used "sqlcmd" to run the
script.
I don't know if you used the "SQL Native Client" and ODBC to connect to the
database? But I testet a connection to the database with "SQL Server
Management Studio" too and I got the same results (a "SELECT * FROM T1"
after connect with user/login "TEST" fails).
I even tried to "SELECT CURRENT_USER" after the connect (as you recommended)
and it returned "dbo".
That's what I expected, because it explains the fact that the "SELECT"
statement fails.
But why? I think the "CURRENT_USER" after connect should be "TEST" not
"dbo". Is there anything wrong in the script "init-db.sql"?
Thanks for your help
Greetings
Michael
--
"Charles Wang[MSFT]" <changliw@online.microsoft.com> schrieb im Newsbeitrag
news:O4KnVyuWHHA.2352@TK2MSFTNGHUB02.phx.gbl...
[quoted text, click to view] > Hi, Michael,
> I understand that you would like to know why the default schema was not
> initially set to "TEST" after you log on your SQL Server with the login
> TEST.
> If I have misunderstood, please let me know.
>
> Unfortunately per my test in SQL Server Management Studio, I could not
> reproduce your issue. My test process was as following:
> 1. Logged on my SQL Server instance with a sysadmin account and created a
> login named "globaltest" with default master database;
> 2. Executed the statement:
> USE TestDB
> CREATE USER TEST FOR LOGIN globaltest WITH DEFAULT_SCHEMA = TEST
> ALTER LOGIN globaltest WITH DEFAULT_DATABASE TestDB
> 3. Executed the statement:
> CREATE SCHEMA TEST AUTHORIZATION TEST;
> 4. Changed a table dbo.T1 to TEST.T1;
> 5. Closed the current connection and connected to the SQL Server instance
> with the login 'globaltest';
> 6. Executed the query:
> SELECT * FROM T1;
> Everything worked fine. Are there some differences between our tests?
>
> I recommend that you run "SELECT CURRENT_USER" to check if the user TEST
> is
> the current user after you log on your SQL Server with the TEST login. You
> may also perform a test according to my steps to see if the issue occurs.
>
> If you have any other questions or concerns, please feel free to let me
> know.
>
> Have a good day!
>
> Charles Wang
> Microsoft Online Community Support
> =====================================================
> Get notification to my posts through email? Please refer to:
>
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif > ications
>
> If you are using Outlook Express, please make sure you clear the check box
> "Tools/Options/Read: Get 300 headers at a time" to see your reply
> promptly.
>
>
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
>
http://msdn.microsoft.com/subscriptions/support/default.aspx. > ======================================================
> When responding to posts, please "Reply to Group" via
> your newsreader so that others may learn and benefit
> from this issue.
> ======================================================
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> ======================================================
>
>
>
begin 666 init-db.sql
M.E)%4T54#0HZ4T545D%2($1"04Y!32!415-41$(-"CI3151605(@1$)!4U12
M("=415-41$(G#0HZ4T545D%2($1"04Q/1R G5$535$1"3$]')PT*.E-%5%9!
M4B!$0D9)3$4@)T,Z7%1%4U1$0BY-1$8G#0HZ4T545D%2($1"3$]'1B G0SI<
M5$535$1"3$]'+DQ$1B<-"CI3151605(@55-24U12("=415-4)PT*.E-%5%9!
M4B!54U).04T@5$535 T*#0HM+2 M+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM
M+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM
M+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM#0HM+2!697)B:6YD=6YG('IU
M<B!$871E;F)A;FL@:&5R<W1E;&QE;@T*+2T@+2TM+2TM+2TM+2TM+2TM+2TM
M+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM
M+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+0T*55-%($U!4U1%
M4CL-"D=/#0H-"@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