Showing posts with label project. Show all posts
Showing posts with label project. Show all posts

Monday, March 19, 2012

"Using other editions of SQL Server for report data sources and/or the report server datab

Hi

My project is in .NET 2003 i.e. framework 1.1 and database in SQLServer 2000. But the reports have been developed using SQLServer 2005 Reporting Services. Now when I am trying to deploy them through deployment project of .NET its giving me following error:

"Using other editions of SQL Server for report data sources and/or the report server database" is not supported in this edition of Reporting Services.

Now I am really confused with this. Can any one please guide me regarding this ASAP.

Thanks,

Falguni

You will need to use the SQL Server 2000 Reporting Services or upgrade to SQL Server 2005. SQL Server Reporting Services 2005 requires SQL 2005 (Express Edition does not count either)|||

hi vcsjones,

Thanks for the reply...

Actually I m trying this with reporting services of SQL Server 2005 trial version (express edition)... and database SQL Server 2000 enterprise edition (licenced version)...

So won't this wrk after mking n e settings or arrangements? Do I need to hv my database also in 2005 and not in 2000?

Thanks and Regards

|||

techieman:

Do I need to hv my database also in 2005 and not in 2000?

Yes that is correct.

|||

On my machine I was having both SQL Server 2000 and SQL Server 2005. I was using project server database and wss database of SQL Server 2000 and Reporting Services and its database of 2005. Accordingly I was getting following error while running reportserver of reporting services 2005:

"Using other editions of SQL Server for report data sources and/or the report server database" is not supported in this edition of Reporting Services

So I uninstalled SQL Server 2000 from my machine. I started using project server database and wss database of SQL Server 2000 from some other machine. For Reporting Services and its database of 2005 it used it from my machine.. So every thing worked fine and its not giving any error.

But my actually requirement is using project server database and wss database of SQL Server 2000 and Reporting Services and its database of 2005 for which I get above error.

So please help me out with this ASAP. Is there any work around for this?

Thanks...

Friday, March 16, 2012

"Timeout expired"

In a legacy project on the production server, we have a database which
generated the following error when executing a report (written in ASP).
Microsoft OLE DB Provider for ODBC Drivers error '80040e31'
[Microsoft][ODBC SQL Server Driver]Timeout expired
I then created a SQL dump of this database and exported the tables to Access
MDB file.
Using another test server, I re-created the entire database using the SQL
dump file and imported the data using Access MDB file. Next, I copied the
entire ASP source tree over to this test server.
Lo and behold, when I ran the same report program, it ran successfully!
Could someone tell me why the legacy project running on the production
server caused this timeout error, while the exact same program running on a
test server runs without problem?
Could it be an indexing issue?
Thanks.Ed,
"Ed" <eddiemarino@.hotmail.com> wrote in message
news:OjVEPFt6DHA.2392@.TK2MSFTNGP11.phx.gbl...
quote:

> Could someone tell me why the legacy project running on the production
> server caused this timeout error, while the exact same program running on

a
quote:

> test server runs without problem?
> Could it be an indexing issue?

Yes, it could be indexing.
It could also be locks, server load, etc.
Dev servers tend to be less busy than production machines, and what works
well in the sandbox might not be so hot when the server's really up against
it.
If you've not done so, start by having ASP developers set a custom timeout
value to something other than the default.
(Assuming, of course, identical schema between test and production <g> )
James Hokes

"Timeout expired"

In a legacy project on the production server, we have a database which
generated the following error when executing a report (written in ASP).
Microsoft OLE DB Provider for ODBC Drivers error '80040e31'
[Microsoft][ODBC SQL Server Driver]Timeout expired
I then created a SQL dump of this database and exported the tables to Access
MDB file.
Using another test server, I re-created the entire database using the SQL
dump file and imported the data using Access MDB file. Next, I copied the
entire ASP source tree over to this test server.
Lo and behold, when I ran the same report program, it ran successfully!
Could someone tell me why the legacy project running on the production
server caused this timeout error, while the exact same program running on a
test server runs without problem?
Could it be an indexing issue?
Thanks.Ed,
"Ed" <eddiemarino@.hotmail.com> wrote in message
news:OjVEPFt6DHA.2392@.TK2MSFTNGP11.phx.gbl...
> Could someone tell me why the legacy project running on the production
> server caused this timeout error, while the exact same program running on
a
> test server runs without problem?
> Could it be an indexing issue?
Yes, it could be indexing.
It could also be locks, server load, etc.
Dev servers tend to be less busy than production machines, and what works
well in the sandbox might not be so hot when the server's really up against
it.
If you've not done so, start by having ASP developers set a custom timeout
value to something other than the default.
(Assuming, of course, identical schema between test and production <g>)
James Hokes

Tuesday, March 6, 2012

"Owner Name" cannot be omitted in sql 2005 querries?

Dear All,
Our project was done in SQL 2000, now we are migrating to 2005.
however, there are lots of command such as:
a) SELECT * FROM myTableName
which, shall be
b) SELECT * FROM myLoginId.myTableName
both (a) and (b) are ok in sql 2000, as long as you login with
myLoginId, but, only (b) works in sql 2005.
seems in sql 2005, you can not omit the "Owner Name" when speifying a
table, unless the table's owner is 'DBO'.
which means, even if I login with myLoginId, I have to use the detailed
format (b),not (a).
this causes trouble in our project -- developed in sql 2000, hundreds
of command omitted the owner name prefix, troublesome to modify one by
one.
Any workaround or suggestions, please? Thanks.
Hi, athos
In SQL Server 2005, schemas and users are different things (in SQL
Server 2000, they were about the same thing). You need to specify the
default schema for each user and then it will work without the prefix.
Use something like this:
ALTER USER myLoginId WITH DEFAULT_SCHEMA = myLoginId
For more informations, see:
http://msdn2.microsoft.com/en-us/library/ms190387.aspx
Razvan
|||Hi Athos
In addition to Razvan's comments, please keep in mind that a login ID and a
database user are two different things. Only a database user can own objects
in a database; a login never does. Although the user name and login id might
be the same name, they are still two different things. And now in SQL 2005
we also have schema names and default schemas. If an object is in your
default schema, no matter who owns the object or the schema, you don't need
to specify the schema.
But it is good practice, and it has ALWAYS been good practice even in SQL
2000, to specify the owner name to avoid ambiguity. There is also a
performance benefit to fully qualifying the object as there is more chance
an existing query plan can be reused the object is fully qualified.
Please read about users and logins in the SQL 2000 BOL.
Please read about user/schema separation in the SQL 2005 BOL.
HTH
Kalen Delaney, SQL Server MVP
www.solidqualitylearning.com
"athos" <athos.liu@.gmail.com> wrote in message
news:1136380087.559222.4320@.o13g2000cwo.googlegrou ps.com...
> Dear All,
> Our project was done in SQL 2000, now we are migrating to 2005.
> however, there are lots of command such as:
> a) SELECT * FROM myTableName
> which, shall be
> b) SELECT * FROM myLoginId.myTableName
> both (a) and (b) are ok in sql 2000, as long as you login with
> myLoginId, but, only (b) works in sql 2005.
> seems in sql 2005, you can not omit the "Owner Name" when speifying a
> table, unless the table's owner is 'DBO'.
> which means, even if I login with myLoginId, I have to use the detailed
> format (b),not (a).
> this causes trouble in our project -- developed in sql 2000, hundreds
> of command omitted the owner name prefix, troublesome to modify one by
> one.
> Any workaround or suggestions, please? Thanks.
>
|||Hi guys,
thanks for your clarificatoin of my misunderstanding of some concepts.
yeah, it's good to fully specify the owner or schema name to avoid
ambiguity, however, it's me that suggest to upgrade our project from
SQL Server 2000 to 2005, and in our developing team I'm trying to avoid
other members' criticizing such as "why shall I search every line to
add some code due to your suggestion?" , or "why something runs fine in
SQL 2000 but not this modern 2005?"
back to my issue, let's say
--On my server "myServer" there is a login named "myLogin", and a
database "myDatabase".
--In "myDatabase" i have a user named "myUserFromMyLogin" which mapped
to the login "myLogin", and a table named "myTable" whose owner (user)
is "myUserFromMyLogin", and a schema named "mySchema" which has one
user "myUserFromMyLogin"
now, "If an object is in your default schema, no matter who owns the
object or the schema, you don't need
to specify the schema. " thanks for you help Kalen, however still a
little bit uncertain here, pls help...
first, when i loggin as the user "myUserFromMyLogin", I shall be using
its default schema "mySchema", right?
second, how to put the object, the table named "myTable", into the
default schema "mySchema"? I can see in the object explorer that the
table's full name is "myUserFromMyLogin.myTable", which means its owner
is "myUserFromMyLogin", which command shall I use to link the object
and the schema?
third, I can directly use commands like "SELECT * FROM myTable" now,
right?
thanks for your valuable time, pls help. Thanks.
yours,
athos.
|||Hi, Athos
If the table's full name is "myUserFromMyLogin.myTable", this means
that it's in the "myUserFromMyLogin" schema. You only need to execute
the following (once), to make the "myUserFromMyLogin" schema to be the
default schema for the "myUserFromMyLogin" user:
ALTER USER myUserFromMyLogin WITH DEFAULT_SCHEMA = myUserFromMyLogin
Razvan
|||Dear Razvan,
Thanks for your reply. Still cannot fix it.
First I made a mistake again. that is, the prefix of the table's
fullname is the schma, not the user.
OK, now what i did is:
Step1. create a Database named [Test], it's default owner is [sa]
Step2. create a User in Database [Test] named [kimliuTest], which maps
to the Login [kkhad\kimliu] on this Database Server, it's a windows
domain user.
Step3. create a Schema in Database [Test] named [schTest], whose Schema
Owner is User [kimliuTest]
Step4. created two tables: [dbo].[t1] and [schTest].[t2]
Step5. run the script
ALTER USER kimliuTest WITH DEFAULT_SCHEMA = schTest
to set the default schema.
now my problem is:
Problem 1.
when I try to run
exec sp_changeobjectowner 'dbo.t1', 'schTest'
exec sp_changeobjectowner 'dbo.t1', 'kimliuTest'
, it returns
Msg 15411, Level 11, State 1, Procedure
sp_changeobjectowner, Line 107
Database principal or schema 'schTest' does not exist in
this database.
Msg 15411, Level 11, State 1, Procedure
sp_changeobjectowner, Line 107
Database principal or schema 'kimliuTest' does not exist in
this database.
why?
Problem 2:
when I try to run
select * from schTest.t2
, everything is OK, but if I run
select * from t2
the error message says:
Msg 208, Level 16, State 1, Line 1
Invalid object name 't2'.
why? I'm loggin in with my [kkhad\kimliu] windows domain id , Active
Monitor also shows that. but the command does not work?
Please help, thank you!
yours,
Athos.
|||Hello, Athos

> Problem 1:
> when I try to run: exec sp_changeobjectowner [...]
> it returns:
> Msg 15411, Level 11, State 1, Procedure sp_changeobjectowner, Line 107
> Database principal or schema 'schTest' does not exist in this database.
Books Online 2005 says the following about sp_changeobjectowner:
Avoid using this feature in new development work, and plan to modify
applications that currently use this feature. Use ALTER SCHEMA or
ALTER AUTHORIZATION instead. sp_changeobjectowner changes both
the schema and the owner. To preserve compatibility with earlier
versions of SQL Server, this stored procedure will only change
object owners when both the current owner and the new owner
own schemas that have the same name as their database user names.
So that's why it didn't work: the schema name and the owner name were
different. We can use one of the following:
ALTER SCHEMA schTest TRANSFER dbo.t1
or:
ALTER AUTHORIZATION ON dbo.t1 to kimliuTest
Note that the two statements written above have different effects:
the first changes the schema, the second changes the owner.
You probably want to run:
ALTER SCHEMA schTest TRANSFER dbo.t1
ALTER AUTHORIZATION ON schTest.t1 TO SCHEMA OWNER
This will make the table to appear as if it was created as
"schTest.t1". Of course, it's better to create the table in the correct
schema from the start (instead of creating it in the dbo schema and
moving it to some other schema after that).

> Problem 2:
> when I try to run [...] select * from t2
> the error message says: "Invalid object name 't2'."
As I've said, you need to change the default schema for the user:
ALTER USER kimliuTest WITH DEFAULT_SCHEMA = schTest
After running the above, if you run "select * from t2" it should work.
You need to keep in mind that if the schema "x" is owned by the user
"y", this does not imply that the user "y" has the schema "x" as his
default schema.
Razvan
|||anybody could help please? thanks!
|||anybody could help, please?
|||anybody could help, please?

"Owner Name" cannot be omitted in sql 2005 querries?

Dear All,
Our project was done in SQL 2000, now we are migrating to 2005.
however, there are lots of command such as:
a) SELECT * FROM myTableName
which, shall be
b) SELECT * FROM myLoginId.myTableName
both (a) and (b) are ok in sql 2000, as long as you login with
myLoginId, but, only (b) works in sql 2005.
seems in sql 2005, you can not omit the "Owner Name" when speifying a
table, unless the table's owner is 'DBO'.
which means, even if I login with myLoginId, I have to use the detailed
format (b),not (a).
this causes trouble in our project -- developed in sql 2000, hundreds
of command omitted the owner name prefix, troublesome to modify one by
one.
Any workaround or suggestions, please? Thanks.Hi, athos
In SQL Server 2005, schemas and users are different things (in SQL
Server 2000, they were about the same thing). You need to specify the
default schema for each user and then it will work without the prefix.
Use something like this:
ALTER USER myLoginId WITH DEFAULT_SCHEMA = myLoginId
For more informations, see:
http://msdn2.microsoft.com/en-us/library/ms190387.aspx
Razvan|||Hi Athos
In addition to Razvan's comments, please keep in mind that a login ID and a
database user are two different things. Only a database user can own objects
in a database; a login never does. Although the user name and login id might
be the same name, they are still two different things. And now in SQL 2005
we also have schema names and default schemas. If an object is in your
default schema, no matter who owns the object or the schema, you don't need
to specify the schema.
But it is good practice, and it has ALWAYS been good practice even in SQL
2000, to specify the owner name to avoid ambiguity. There is also a
performance benefit to fully qualifying the object as there is more chance
an existing query plan can be reused the object is fully qualified.
Please read about users and logins in the SQL 2000 BOL.
Please read about user/schema separation in the SQL 2005 BOL.
HTH
Kalen Delaney, SQL Server MVP
www.solidqualitylearning.com
"athos" <athos.liu@.gmail.com> wrote in message
news:1136380087.559222.4320@.o13g2000cwo.googlegroups.com...
> Dear All,
> Our project was done in SQL 2000, now we are migrating to 2005.
> however, there are lots of command such as:
> a) SELECT * FROM myTableName
> which, shall be
> b) SELECT * FROM myLoginId.myTableName
> both (a) and (b) are ok in sql 2000, as long as you login with
> myLoginId, but, only (b) works in sql 2005.
> seems in sql 2005, you can not omit the "Owner Name" when speifying a
> table, unless the table's owner is 'DBO'.
> which means, even if I login with myLoginId, I have to use the detailed
> format (b),not (a).
> this causes trouble in our project -- developed in sql 2000, hundreds
> of command omitted the owner name prefix, troublesome to modify one by
> one.
> Any workaround or suggestions, please? Thanks.
>|||Hi guys,
thanks for your clarificatoin of my misunderstanding of some concepts.
yeah, it's good to fully specify the owner or schema name to avoid
ambiguity, however, it's me that suggest to upgrade our project from
SQL Server 2000 to 2005, and in our developing team I'm trying to avoid
other members' criticizing such as "why shall I search every line to
add some code due to your suggestion?" , or "why something runs fine in
SQL 2000 but not this modern 2005?"
back to my issue, let's say
--On my server "myServer" there is a login named "myLogin", and a
database "myDatabase".
--In "myDatabase" i have a user named "myUserFromMyLogin" which mapped
to the login "myLogin", and a table named "myTable" whose owner (user)
is "myUserFromMyLogin", and a schema named "mySchema" which has one
user "myUserFromMyLogin"
now, "If an object is in your default schema, no matter who owns the
object or the schema, you don't need
to specify the schema. " thanks for you help Kalen, however still a
little bit uncertain here, pls help...
first, when i loggin as the user "myUserFromMyLogin", I shall be using
its default schema "mySchema", right?
second, how to put the object, the table named "myTable", into the
default schema "mySchema"? I can see in the object explorer that the
table's full name is "myUserFromMyLogin.myTable", which means its owner
is "myUserFromMyLogin", which command shall I use to link the object
and the schema?
third, I can directly use commands like "SELECT * FROM myTable" now,
right?
thanks for your valuable time, pls help. Thanks.
yours,
athos.|||Hi, Athos
If the table's full name is "myUserFromMyLogin.myTable", this means
that it's in the "myUserFromMyLogin" schema. You only need to execute
the following (once), to make the "myUserFromMyLogin" schema to be the
default schema for the "myUserFromMyLogin" user:
ALTER USER myUserFromMyLogin WITH DEFAULT_SCHEMA = myUserFromMyLogin
Razvan|||Dear Razvan,
Thanks for your reply. Still cannot fix it.
First I made a mistake again. that is, the prefix of the table's
fullname is the schma, not the user.
OK, now what i did is:
Step1. create a Database named [Test], it's default owner is [sa]
Step2. create a User in Database [Test] named [kimliuTest], which ma
ps
to the Login [kkhad\kimliu] on this Database Server, it's a windows
domain user.
Step3. create a Schema in Database [Test] named [schTest], whose Sch
ema
Owner is User [kimliuTest]
Step4. created two tables: [dbo].[t1] and [schTest].[t2]
Step5. run the script
ALTER USER kimliuTest WITH DEFAULT_SCHEMA = schTest
to set the default schema.
now my problem is:
Problem 1.
when I try to run
exec sp_changeobjectowner 'dbo.t1', 'schTest'
exec sp_changeobjectowner 'dbo.t1', 'kimliuTest'
, it returns
Msg 15411, Level 11, State 1, Procedure
sp_changeobjectowner, Line 107
Database principal or schema 'schTest' does not exist in
this database.
Msg 15411, Level 11, State 1, Procedure
sp_changeobjectowner, Line 107
Database principal or schema 'kimliuTest' does not exist in
this database.
why?
Problem 2:
when I try to run
select * from schTest.t2
, everything is OK, but if I run
select * from t2
the error message says:
Msg 208, Level 16, State 1, Line 1
Invalid object name 't2'.
why? I'm loggin in with my [kkhad\kimliu] windows domain id , Active
Monitor also shows that. but the command does not work?
Please help, thank you!
yours,
Athos.|||Hello, Athos

> Problem 1:
> when I try to run: exec sp_changeobjectowner [...]
> it returns:
> Msg 15411, Level 11, State 1, Procedure sp_changeobjectowner, Line 107
> Database principal or schema 'schTest' does not exist in this database.
Books Online 2005 says the following about sp_changeobjectowner:
Avoid using this feature in new development work, and plan to modify
applications that currently use this feature. Use ALTER SCHEMA or
ALTER AUTHORIZATION instead. sp_changeobjectowner changes both
the schema and the owner. To preserve compatibility with earlier
versions of SQL Server, this stored procedure will only change
object owners when both the current owner and the new owner
own schemas that have the same name as their database user names.
So that's why it didn't work: the schema name and the owner name were
different. We can use one of the following:
ALTER SCHEMA schTest TRANSFER dbo.t1
or:
ALTER AUTHORIZATION ON dbo.t1 to kimliuTest
Note that the two statements written above have different effects:
the first changes the schema, the second changes the owner.
You probably want to run:
ALTER SCHEMA schTest TRANSFER dbo.t1
ALTER AUTHORIZATION ON schTest.t1 TO SCHEMA OWNER
This will make the table to appear as if it was created as
"schTest.t1". Of course, it's better to create the table in the correct
schema from the start (instead of creating it in the dbo schema and
moving it to some other schema after that).

> Problem 2:
> when I try to run [...] select * from t2
> the error message says: "Invalid object name 't2'."
As I've said, you need to change the default schema for the user:
ALTER USER kimliuTest WITH DEFAULT_SCHEMA = schTest
After running the above, if you run "select * from t2" it should work.
You need to keep in mind that if the schema "x" is owned by the user
"y", this does not imply that the user "y" has the schema "x" as his
default schema.
Razvan|||anybody could help please? thanks!|||anybody could help, please?|||anybody could help, please?

"owner name" cannot be omitted in sql 2005 querries?

Dear All,

Our project was done in SQL 2000, now we are migrating to 2005.
however, there are lots of command such as:

a) SELECT * FROM myTableName

which, shall be

b) SELECT * FROM myLoginId.myTableName

both (a) and (b) are ok in sql 2000, as long as you login with
myLoginId, but, only (b) works in sql 2005.

seems in sql 2005, you can not omit the "Owner Name" when speifying a
table, unless the table's owner is 'DBO'.

which means, even if I login with myLoginId, I have to use the detailed
format (b),not (a).

this causes trouble in our project -- developed in sql 2000, hundreds
of command omitted the owner name prefix, troublesome to modify one by
one.

Any workaround or suggestions, please? Thanks.Hi, athos

Please do not "multi-post". If you really want to send a message to
more than one newsgroup, post a single message with all the newsgroups
in the "To:" field (this is called "cross-posting". See:
http://www.aspfaq.com/etiquette.asp?id=5003
http://www.aspfaq.com/etiquette.asp?id=5004

See my answer in the microsoft.public.sqlserver.server newsgroup:
http://groups.google.com/group/micr...ede4803725ce795

Razvan|||Dear Razvan,

thanks for your information. Sorry I never noticed the line saying
"(Separate multiple groups with commas)". thanks.

yours
Athos.

"Owner Name" cannot be omitted in sql 2005 querries?

Dear All,
Our project was done in SQL 2000, now we are migrating to 2005.
however, there are lots of command such as:
a) SELECT * FROM myTableName
which, shall be
b) SELECT * FROM myLoginId.myTableName
both (a) and (b) are ok in sql 2000, as long as you login with
myLoginId, but, only (b) works in sql 2005.
seems in sql 2005, you can not omit the "Owner Name" when speifying a
table, unless the table's owner is 'DBO'.
which means, even if I login with myLoginId, I have to use the detailed
format (b),not (a).
this causes trouble in our project -- developed in sql 2000, hundreds
of command omitted the owner name prefix, troublesome to modify one by
one.
Any workaround or suggestions, please? Thanks.Hi, athos
In SQL Server 2005, schemas and users are different things (in SQL
Server 2000, they were about the same thing). You need to specify the
default schema for each user and then it will work without the prefix.
Use something like this:
ALTER USER myLoginId WITH DEFAULT_SCHEMA = myLoginId
For more informations, see:
http://msdn2.microsoft.com/en-us/library/ms190387.aspx
Razvan|||Hi Athos
In addition to Razvan's comments, please keep in mind that a login ID and a
database user are two different things. Only a database user can own objects
in a database; a login never does. Although the user name and login id might
be the same name, they are still two different things. And now in SQL 2005
we also have schema names and default schemas. If an object is in your
default schema, no matter who owns the object or the schema, you don't need
to specify the schema.
But it is good practice, and it has ALWAYS been good practice even in SQL
2000, to specify the owner name to avoid ambiguity. There is also a
performance benefit to fully qualifying the object as there is more chance
an existing query plan can be reused the object is fully qualified.
Please read about users and logins in the SQL 2000 BOL.
Please read about user/schema separation in the SQL 2005 BOL.
--
HTH
Kalen Delaney, SQL Server MVP
www.solidqualitylearning.com
"athos" <athos.liu@.gmail.com> wrote in message
news:1136380087.559222.4320@.o13g2000cwo.googlegroups.com...
> Dear All,
> Our project was done in SQL 2000, now we are migrating to 2005.
> however, there are lots of command such as:
> a) SELECT * FROM myTableName
> which, shall be
> b) SELECT * FROM myLoginId.myTableName
> both (a) and (b) are ok in sql 2000, as long as you login with
> myLoginId, but, only (b) works in sql 2005.
> seems in sql 2005, you can not omit the "Owner Name" when speifying a
> table, unless the table's owner is 'DBO'.
> which means, even if I login with myLoginId, I have to use the detailed
> format (b),not (a).
> this causes trouble in our project -- developed in sql 2000, hundreds
> of command omitted the owner name prefix, troublesome to modify one by
> one.
> Any workaround or suggestions, please? Thanks.
>|||Hi guys,
thanks for your clarificatoin of my misunderstanding of some concepts.
yeah, it's good to fully specify the owner or schema name to avoid
ambiguity, however, it's me that suggest to upgrade our project from
SQL Server 2000 to 2005, and in our developing team I'm trying to avoid
other members' criticizing such as "why shall I search every line to
add some code due to your suggestion?" , or "why something runs fine in
SQL 2000 but not this modern 2005?"
back to my issue, let's say
--On my server "myServer" there is a login named "myLogin", and a
database "myDatabase".
--In "myDatabase" i have a user named "myUserFromMyLogin" which mapped
to the login "myLogin", and a table named "myTable" whose owner (user)
is "myUserFromMyLogin", and a schema named "mySchema" which has one
user "myUserFromMyLogin"
now, "If an object is in your default schema, no matter who owns the
object or the schema, you don't need
to specify the schema. " thanks for you help Kalen, however still a
little bit uncertain here, pls help...
first, when i loggin as the user "myUserFromMyLogin", I shall be using
its default schema "mySchema", right?
second, how to put the object, the table named "myTable", into the
default schema "mySchema"? I can see in the object explorer that the
table's full name is "myUserFromMyLogin.myTable", which means its owner
is "myUserFromMyLogin", which command shall I use to link the object
and the schema?
third, I can directly use commands like "SELECT * FROM myTable" now,
right?
thanks for your valuable time, pls help. Thanks.
yours,
athos.|||Hi, Athos
If the table's full name is "myUserFromMyLogin.myTable", this means
that it's in the "myUserFromMyLogin" schema. You only need to execute
the following (once), to make the "myUserFromMyLogin" schema to be the
default schema for the "myUserFromMyLogin" user:
ALTER USER myUserFromMyLogin WITH DEFAULT_SCHEMA = myUserFromMyLogin
Razvan|||Dear Razvan,
Thanks for your reply. Still cannot fix it.
First I made a mistake again. that is, the prefix of the table's
fullname is the schma, not the user.
OK, now what i did is:
Step1. create a Database named [Test], it's default owner is [sa]
Step2. create a User in Database [Test] named [kimliuTest], which maps
to the Login [kkhad\kimliu] on this Database Server, it's a windows
domain user.
Step3. create a Schema in Database [Test] named [schTest], whose Schema
Owner is User [kimliuTest]
Step4. created two tables: [dbo].[t1] and [schTest].[t2]
Step5. run the script
ALTER USER kimliuTest WITH DEFAULT_SCHEMA = schTest
to set the default schema.
now my problem is:
Problem 1.
when I try to run
exec sp_changeobjectowner 'dbo.t1', 'schTest'
exec sp_changeobjectowner 'dbo.t1', 'kimliuTest'
, it returns
Msg 15411, Level 11, State 1, Procedure
sp_changeobjectowner, Line 107
Database principal or schema 'schTest' does not exist in
this database.
Msg 15411, Level 11, State 1, Procedure
sp_changeobjectowner, Line 107
Database principal or schema 'kimliuTest' does not exist in
this database.
why?
Problem 2:
when I try to run
select * from schTest.t2
, everything is OK, but if I run
select * from t2
the error message says:
Msg 208, Level 16, State 1, Line 1
Invalid object name 't2'.
why? I'm loggin in with my [kkhad\kimliu] windows domain id , Active
Monitor also shows that. but the command does not work?
Please help, thank you!
yours,
Athos.|||Hello, Athos
> Problem 1:
> when I try to run: exec sp_changeobjectowner [...]
> it returns:
> Msg 15411, Level 11, State 1, Procedure sp_changeobjectowner, Line 107
> Database principal or schema 'schTest' does not exist in this database.
Books Online 2005 says the following about sp_changeobjectowner:
Avoid using this feature in new development work, and plan to modify
applications that currently use this feature. Use ALTER SCHEMA or
ALTER AUTHORIZATION instead. sp_changeobjectowner changes both
the schema and the owner. To preserve compatibility with earlier
versions of SQL Server, this stored procedure will only change
object owners when both the current owner and the new owner
own schemas that have the same name as their database user names.
So that's why it didn't work: the schema name and the owner name were
different. We can use one of the following:
ALTER SCHEMA schTest TRANSFER dbo.t1
or:
ALTER AUTHORIZATION ON dbo.t1 to kimliuTest
Note that the two statements written above have different effects:
the first changes the schema, the second changes the owner.
You probably want to run:
ALTER SCHEMA schTest TRANSFER dbo.t1
ALTER AUTHORIZATION ON schTest.t1 TO SCHEMA OWNER
This will make the table to appear as if it was created as
"schTest.t1". Of course, it's better to create the table in the correct
schema from the start (instead of creating it in the dbo schema and
moving it to some other schema after that).
> Problem 2:
> when I try to run [...] select * from t2
> the error message says: "Invalid object name 't2'."
As I've said, you need to change the default schema for the user:
ALTER USER kimliuTest WITH DEFAULT_SCHEMA = schTest
After running the above, if you run "select * from t2" it should work.
You need to keep in mind that if the schema "x" is owned by the user
"y", this does not imply that the user "y" has the schema "x" as his
default schema.
Razvan|||anybody could help please? thanks!|||anybody could help, please?|||anybody could help, please?|||anybody could help please?|||Dear Razvan,
Thanks for you explanation about [sp_changeobjectowner], [ALTER
SCHEMA..] and [ALTER AUTHORIZATION ..], however, the main issue is
still not solved.
Maybe there is some misunderstanding, what I did is:
Step1. create a Database named [Test] with default owner [sa]
Step2. in Database [Test], create a User [kimliuTest] mapping to Login
[kimliu] on this Database Server
Step3. in Database [Test], create a Schema [schTest] owned by
[kimliuTest]
Step4. created two tables: [dbo].[t1] and [schTest].[t2]
Step5. run the script
ALTER USER kimliuTest WITH DEFAULT_SCHEMA = schTest
to set the default schema.
Repeat, I HAVE gone through Step 5, run the script "ALTER USER
kimliuTest WITH DEFAULT_SCHEMA = schTest " to set the default schema.
Then, after all of these steps --
Case 1: Of course, everything is OK when run "SELECT * FROM
schTest.t2", either by running in a SQL Query Editor Window or by .net
code.
Case 2: Cannot use "SELECT * FROM t2", the error message says: "Msg
208, Level 16, State 1, Line 1, Invalid object name 't2'. ".
Case 3: Strangely enough, everything is OK when run "EXECUTE AS
USER='kimliuTest'; SELECT * FROM schTest.t2".
Case 4: Everything is also OK when only run "EXECUTE AS LOGIN='kimliu'
".
Case 5: But, cannot use "EXECUTE AS LOGIN='kimliu'; SELECT * FROM t2",
the error message is the same: "Msg 208, Level 16, State 1, Line 1,
Invalid object name 't2'. ".
I am LOST! Anybody could help PLEASE~~ Thank you very much~
yours
Athos|||Dear Razvan,
Thanks for you explanation about [sp_changeobjectowner], [ALTER
SCHEMA..] and [ALTER AUTHORIZATION ..], however, the main issue is
still not solved.
Maybe there is some misunderstanding, what I did is:
Step1. create a Database named [Test] with default owner [sa]
Step2. in Database [Test], create a User [kimliuTest] mapping to Login
[kimliu] on this Database Server
Step3. in Database [Test], create a Schema [schTest] owned by
[kimliuTest]
Step4. created two tables: [dbo].[t1] and [schTest].[t2]
Step5. run the script
ALTER USER kimliuTest WITH DEFAULT_SCHEMA = schTest
to set the default schema.
Repeat, I HAVE gone through Step 5, run the script "ALTER USER
kimliuTest WITH DEFAULT_SCHEMA = schTest " to set the default schema.
Then, after all of these steps --
Case 1: Of course, everything is OK when run "SELECT * FROM
schTest.t2", either by running in a SQL Query Editor Window or by .net
code.
Case 2: Cannot use "SELECT * FROM t2", the error message says: "Msg
208, Level 16, State 1, Line 1, Invalid object name 't2'. ".
Case 3: Strangely enough, everything is OK when run "EXECUTE AS
USER='kimliuTest'; SELECT * FROM t2".
Case 4: Everything is also OK when only run "EXECUTE AS LOGIN='kimliu'
".
Case 5: But, cannot use "EXECUTE AS LOGIN='kimliu'; SELECT * FROM t2",
the error message is the same: "Msg 208, Level 16, State 1, Line 1,
Invalid object name 't2'. ".
I am LOST! Anybody could help PLEASE~~ Thank you very much~
yours
Athos|||Hi, Athos
> Repeat, I HAVE gone through Step 5, run the script "ALTER USER
> kimliuTest WITH DEFAULT_SCHEMA = schTest " to set the default schema.
Sorry, I overlook that part when I first read your previous message.
I was able to reproduce the behaviour you mentioned, but not
consistently.
Please try the following:
USE test
EXECUTE AS LOGIN='kkhad\kimliu'
SELECT SYSTEM_USER AS SystemUser, DB_NAME() as DatabaseName,
USER as UserName, default_schema_name
FROM sys.database_principals WHERE name=USER
REVERT
What result do you get ?
Razvan

"Object reference not set to an instance of an object" When Retrieving Data/Schema in Desi

Hi There,

This is related to a ms access database but since I use the SqlDataSource control I thought I should post here.
I have a project that I was working on with this ms access db and using sql controls, everything was working just fine
since one day I started getting "Object reference not set to an instance of an object" messages when I try to design
a query or retrieve a schema, nothing works at design time anymore but at runtime everything is perfect, its a lot
of work for me now to create columns,schemas and everything manually, I've tried reinstalling visualstudio, ado components
but nothing seems to fix it, did this ever happen to any of you guys?

any tip is really appreciated

thanks a lot

Hi faguiar,

You wouldn't have to use DataSet Typed. You should have to use BusinessEntities.

Good Coding!

Javier Luna
http://guydotnetxmlwebservices.blogspot.com/

|||

but it used to work fine before, I'm pretty sure this is a nasty ide bug that needs a hack but I can't find a solution myself.

thank you

Thursday, February 9, 2012

"Cannot Open Database" problem when copy project to IIS

Hi all.

I use VWD 2005 Express with SQL Server 2005 Express as a database.

I copy my project to IIS and try to run it at the IIS Web Server.

I already amended the connection string at web.config file as below:

<connectionStrings> <add name="GeekSpeakConnectionString" connectionString="Data Source=SEN-M09\SQLEXPRESS;Database=GeekSpeak.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True" providerName="System.Data.SqlClient" /></connectionStrings>
But, I got this error:

Cannot open database "GeekSpeak.mdf" requested by the login. The login failed.
Login failed for user 'SEN-M09\ASPNET'.

I also has granted to userSEN-M09\ASPNET .Still, I got this error. Why?

I manage to solve this problem after reading the articlehere.

Thanks.

Friday, January 27, 2012

!

Dear all,

I was given a project to transfer our database into sql server database.

In our previous database we used the datatype int4 for some columns to create some views and in some queries that we used to build our datawindows. In SQLServer 2000 i created a user defined function named int4. I can execute it with the line select dbo.int4(poso) from employee .

Unfortrunately this way make me to rebuild all my datawindows and replace int4( with dbo.int4( . Is there any way to execute queries using user defined function but omitting the first part name dbo. I mean to manage execute the command select int4(poso) from employee \\let int4 be a user definded function.

If i create an ODBC function i must use select fn int4(poso) from employee

I thing i could solve this if i could create a system function int4() but i have no idea how it can be done.

If i can’t solve this, i thing it will decided than is impossible to move to sqlserver Database. Has anyone any suggestions?

Thanks in advance,

Best regards,

In SQL Server, you are not allowed to create a system functions. There is no other choice. You have to use the dbo.int4().

But I am not sure what you are doing inside this function. How important it is. If it is permanent for all the query call, better update the values on the main table itself (using update statement) & take care while inserting these values.

|||

No, you will have to use the owner /schema prefix for the new defined function.

Jens K. Suessmeyer

http://www.sqlserver2005.de

|||

Hellen, please do not multipost.

Jens K. Suessmeyer

http://www.sqlserver2005.de

|||

Firstly many thanks for your reply!!!

As i said, i want to create this function so as not to change at all the code of our programs. Inside the code we use select statements and we use in a lot of points int4(). It is necessary as i have functions that i use to my database and i want to have the optional to use sqlserver database without changing at all my code.

As you said it is not possible in Sql Server as i am not allowed to create system functions. Is it possible inSql Server 2005 or 2008 to create system functions?

Any ideas of how i could create an odbc function but include the function in a select statement without the fn prefix? Or should i abandon the idea of moving to a strong database?

|||

No, this is not possible as far as I know. You should consider trying to change the code logic to support this (strong9 syntax :-)

Jens K. Suessmeyer

http://www.sqlserver2005.de