Showing posts with label schemas. Show all posts
Showing posts with label schemas. Show all posts

Monday, March 19, 2012

Database Schemas and "This statement has attempted to access data whose access is restricte

Hello.

In reference to my post yesterday which got removed when i edited this one: After trying a few things i realized that the reason i was getting the error "Invalid use of side-effecting or time-dependent operator in 'SET ON/OFF' within a function." was because a CLR function was executing a stored procedure, which for whatever reason i completely disregarded the fact that functions cannot call stored procedures. After removing that i am faced with the second issue of my assembly being restricted.
I now get the error "This statement has attempted to access data whose access is restricted by the assembly" I am not certain what is causing this, but i think it has something to do with the database security i am using. I created a schema whose owner is dbo. All my database objects are in this schema. The assembly's owner is also dbo. However accessing my database objects in my custom schema will give me the error talking about access restricted by the assembly. Does anyone have any idea why my assembly cannot access data that is owned by the assembly's owner?

Thanks!It looks like you are missing either
DataAccess=DataAccessKind.Read
or SystemDataAccess=SystemDataAccessKind.Read
in your SQLFunction attribute.

Could you please provide your code.

Thanks,
-Vineet.
|||

I am including the attribute but stll get the error, plus did try the SystemDataAccess attribute. This is the code:

[SqlFunction(DataAccess = DataAccessKind.Read)]

public static SqlString GetDisplayName(SqlGuid id)

{

if (id.IsNull) return SqlString.Null;

string itemTypeFullName = String.Empty;

using (SqlConnection connection = new SqlConnection("context connection=true"))

{

string sql = @."SELECT [itemtype-full-name] FROM [ItemType] WHERE [id] = '"+id.ToString()+"'";

using (SqlCommand command = new SqlCommand(sql, connection))

{

try

{

connection.Open();

itemTypeFullName = (string)command.ExecuteScalar();

|||I got the same error "This statement has attempted to access data whose access is restricted by the assembly".

I specified DataAccessKind.Read and SystemDataAccessKind.Read and that helped

[Microsoft.SqlServer.Server.SqlFunction(DataAccess=DataAccessKind.Read, SystemDataAccess=SystemDataAccessKind.Read)]

Database Schemas and "This statement has attempted to access data whose access is restricte

Hello.

In reference to my post yesterday which got removed when i edited this one: After trying a few things i realized that the reason i was getting the error "Invalid use of side-effecting or time-dependent operator in 'SET ON/OFF' within a function." was because a CLR function was executing a stored procedure, which for whatever reason i completely disregarded the fact that functions cannot call stored procedures. After removing that i am faced with the second issue of my assembly being restricted.
I now get the error "This statement has attempted to access data whose access is restricted by the assembly" I am not certain what is causing this, but i think it has something to do with the database security i am using. I created a schema whose owner is dbo. All my database objects are in this schema. The assembly's owner is also dbo. However accessing my database objects in my custom schema will give me the error talking about access restricted by the assembly. Does anyone have any idea why my assembly cannot access data that is owned by the assembly's owner?

Thanks!It looks like you are missing either
DataAccess=DataAccessKind.Read
or SystemDataAccess=SystemDataAccessKind.Read
in your SQLFunction attribute.

Could you please provide your code.

Thanks,
-Vineet.
|||

I am including the attribute but stll get the error, plus did try the SystemDataAccess attribute. This is the code:

[SqlFunction(DataAccess = DataAccessKind.Read)]

public static SqlString GetDisplayName(SqlGuid id)

{

if (id.IsNull) return SqlString.Null;

string itemTypeFullName = String.Empty;

using (SqlConnection connection = new SqlConnection("context connection=true"))

{

string sql = @."SELECT [itemtype-full-name] FROM [ItemType] WHERE [id] = '"+id.ToString()+"'";

using (SqlCommand command = new SqlCommand(sql, connection))

{

try

{

connection.Open();

itemTypeFullName = (string)command.ExecuteScalar();

|||I got the same error "This statement has attempted to access data whose access is restricted by the assembly".

I specified DataAccessKind.Read and SystemDataAccessKind.Read and that helped

[Microsoft.SqlServer.Server.SqlFunction(DataAccess=DataAccessKind.Read, SystemDataAccess=SystemDataAccessKind.Read)]

Database Schemas and "This statement has attempted to access data whose access is restr

Hello.

In reference to my post yesterday which got removed when i edited this one: After trying a few things i realized that the reason i was getting the error "Invalid use of side-effecting or time-dependent operator in 'SET ON/OFF' within a function." was because a CLR function was executing a stored procedure, which for whatever reason i completely disregarded the fact that functions cannot call stored procedures. After removing that i am faced with the second issue of my assembly being restricted.
I now get the error "This statement has attempted to access data whose access is restricted by the assembly" I am not certain what is causing this, but i think it has something to do with the database security i am using. I created a schema whose owner is dbo. All my database objects are in this schema. The assembly's owner is also dbo. However accessing my database objects in my custom schema will give me the error talking about access restricted by the assembly. Does anyone have any idea why my assembly cannot access data that is owned by the assembly's owner?

Thanks!It looks like you are missing either
DataAccess=DataAccessKind.Read
or SystemDataAccess=SystemDataAccessKind.Read
in your SQLFunction attribute.

Could you please provide your code.

Thanks,
-Vineet.
|||

I am including the attribute but stll get the error, plus did try the SystemDataAccess attribute. This is the code:

[SqlFunction(DataAccess = DataAccessKind.Read)]

public static SqlString GetDisplayName(SqlGuid id)

{

if (id.IsNull) return SqlString.Null;

string itemTypeFullName = String.Empty;

using (SqlConnection connection = new SqlConnection("context connection=true"))

{

string sql = @."SELECT [itemtype-full-name] FROM [ItemType] WHERE [id] = '"+id.ToString()+"'";

using (SqlCommand command = new SqlCommand(sql, connection))

{

try

{

connection.Open();

itemTypeFullName = (string)command.ExecuteScalar();

|||I got the same error "This statement has attempted to access data whose access is restricted by the assembly".

I specified DataAccessKind.Read and SystemDataAccessKind.Read and that helped

[Microsoft.SqlServer.Server.SqlFunction(DataAccess=DataAccessKind.Read, SystemDataAccess=SystemDataAccessKind.Read)]

Database Schema Printout

I have 2 schemas. One with 90 tables and another with about 42 tables.
I generated the database diagram thru Sql Server for both schemas.
How would one print out the whole schema diagram?
Company has no big printer which can do this.
Kinkos is an option. If so how would I copy or send a database diagram file
to them ?
thx a lot...Unfortunately you cannot move the diagram out to a Generic format.
You can only move from Database to another. Refer :
http://support.microsoft.com/defaul...b;en-us;Q320125
But here is a work around option for you, if you have Microsoft visio 2000.
You can Reverse Engineer a DB from Visio. Follow the Instructiopns Below.
After Reverse Engineering Save the Diagram as JPG or BMP, which is portable
HTH
Satish Balusa
Corillian Corp.
From BOL of visio 2000
To reverse engineer an existing database
1.. Choose File > New > Database > Database Model Diagram.
2.. Choose Database > Reverse Engineer.
3.. On the first screen of the Reverse Engineer Wizard, do the following:
a.. Select the visio database driver for your database management system
(DBMS).
If you have not already associated the visio database driver with a
particular 32-bit ODBC data source, do so now.
b.. Select the data source of the database you're updating.
If you have not already created a data source for the existing database,
do so now.
When you create a new source, your visio product adds its name to the
Data Sources list.
c.. When you are satisfied with your settings, click Next.
4.. Follow the instructions in any driver-specific dialog boxes.
For example, in the Connect Data Source dialog box, type a user name and
password, and then click OK.
5.. Check the boxes for the type of information you want to extract, and
then click Next.
6.. Check the tables (and views, if any) that you want to extract, or
click Select All to extract them all, and then click Next.
7.. If you checked Stored Procedures in step 5, on the next screen check
the procedures that you want to extract, or click Select All to extract them
all, and then click Next.
8.. Review your selections to verify that you are extracting the
information you want, and then click Finish.
The wizard extracts the selected information and displays notes about the
extraction process in the Output window.
9.. Create a diagram of your model by
a.. Dragging the tables you want to view from the Tables window onto the
drawing page.
b.. Using the Show Related Tables command to view the tables related to
a particular table.
"giny" <anonymous@.discussions.microsoft.com> wrote in message
news:45E8EC17-3B48-41F7-BF3D-4C5A6EC7D93C@.microsoft.com...
quote:

> I have 2 schemas. One with 90 tables and another with about 42 tables.
> I generated the database diagram thru Sql Server for both schemas.
> How would one print out the whole schema diagram?
> Company has no big printer which can do this.
> Kinkos is an option. If so how would I copy or send a database diagram

file to them ?
quote:

> thx a lot...

Database schema differences

Hello,
Is there any way to compare two schemas and see the differences. Usual
story - client has changed their database structure, sent me a new
copy and I need to know what's changed without looking at each
table...best I've come up with so far is to script each database and
look at the scripts in Notepad...me thinks there must be a better way.
Cheers
Ray
Hi
Tools such as Red Gates SQL Compare, DBGhost etc can do that and also script
the changes needed to return it back to what it should be!
John
"rbrowning1958" <RBrowning1958@.gmail.com> wrote in message
news:91e2428a-0140-468c-8420-d3b3a09cb18f@.s37g2000prg.googlegroups.com...
> Hello,
> Is there any way to compare two schemas and see the differences. Usual
> story - client has changed their database structure, sent me a new
> copy and I need to know what's changed without looking at each
> table...best I've come up with so far is to script each database and
> look at the scripts in Notepad...me thinks there must be a better way.
> Cheers
> Ray
|||The free, open-source SchemaCrawler for SQL Server tool will do this
for you. You can take human-readable snapshots of the schema and data,
for later comparison. Comparisons are done using a standard diff tool
such as WinMerge. SchemaCrawler outputs details of your schema
(tables, views, procedures, and more) in a diff-able plain-text format
(text, CSV, or XHTML). SchemaCrawler can also output data (including
CLOBs and BLOBs) in the same plain-text formats.
SchemaCrawler is available at SourceForge:
http://schemacrawler.sourceforge.net/
Sualeh Fatehi
|||Try AlfaAlfa's SQL Server Comparison Tool (SCT)
http://www.sql-server-tool.com
- you can easily compare structures of tables, procedures, functions,
views, triggers and relationships.
Comparison "sessions" can be saved and re-played later without the
need of re-entering the parameters;
command line parameter can be used to fully automate comparisons.
Dariusz Dziewialtowski.

Database schema differences

Hello,
Is there any way to compare two schemas and see the differences. Usual
story - client has changed their database structure, sent me a new
copy and I need to know what's changed without looking at each
table...best I've come up with so far is to script each database and
look at the scripts in Notepad...me thinks there must be a better way.
Cheers
RayHi
Tools such as Red Gates SQL Compare, DBGhost etc can do that and also script
the changes needed to return it back to what it should be!
John
"rbrowning1958" <RBrowning1958@.gmail.com> wrote in message
news:91e2428a-0140-468c-8420-d3b3a09cb18f@.s37g2000prg.googlegroups.com...
> Hello,
> Is there any way to compare two schemas and see the differences. Usual
> story - client has changed their database structure, sent me a new
> copy and I need to know what's changed without looking at each
> table...best I've come up with so far is to script each database and
> look at the scripts in Notepad...me thinks there must be a better way.
> Cheers
> Ray|||The free, open-source SchemaCrawler for SQL Server tool will do this
for you. You can take human-readable snapshots of the schema and data,
for later comparison. Comparisons are done using a standard diff tool
such as WinMerge. SchemaCrawler outputs details of your schema
(tables, views, procedures, and more) in a diff-able plain-text format
(text, CSV, or XHTML). SchemaCrawler can also output data (including
CLOBs and BLOBs) in the same plain-text formats.
SchemaCrawler is available at SourceForge:
http://schemacrawler.sourceforge.net/
Sualeh Fatehi|||Try AlfaAlfa's SQL Server Comparison Tool (SCT)
http://www.sql-server-tool.com
- you can easily compare structures of tables, procedures, functions,
views, triggers and relationships.
Comparison "sessions" can be saved and re-played later without the
need of re-entering the parameters;
command line parameter can be used to fully automate comparisons.
Dariusz Dziewialtowski.