Showing posts with label solve. Show all posts
Showing posts with label solve. Show all posts

Wednesday, March 28, 2012

persisting data for a pluggable tree

Hi all,

I am rather new to database design and modelling concepts in general
and was hoping for some advice on a problem I am trying to solve. I
have designed a piece of software that creates a tree with pluggable
nodes. Each node class can have 0 to n distinct classes plugged into
it to define the type for that node.

For example, a node plugged with a 'customer' class and an 'engineer'
class would indicate that this node in the tree is an engineer who is
also a customer. We could also have a 'owner', 'engineer' etc.

I now want to persist this tree in an SQL Server 2000 Database. I have
chosen to implement the nested set model, and have thought about the
following table design:

table NODE_TABLE:
lft INTEGER
rft INTEGER
propsID INTEGER

table PROPERTIES_TABLE:
propsID INTEGER
tableName VARCHAR

table CUSTOMER_TABLE:
propsID INTEGER
firstname CHAR
lastname CHAR

table ENGINEER_TABLE:
propsID INTEGER
num_completed_projects INTEGER
degree CHAR
school CHAR

table OWNER_TABLE:
propsID INTEGER
companyName CHAR

So, given the above example - I would have a NODE_TABLE that links to 2
entries in PROPERTIES_TABLE. One entry would link to an entry in the
CUSTOMER_TABLE, the other to an entry in ENGINEER_TABLE.

Are there any more efficient solutions to this problem? As i said, I
am very new to DB design and would welcome any feedback or suggestions
of how else I might model my pluggable tree in a Database. Thank you,

Bob YohanYou can get a copy of my book TREES & HIERARCHIES IN SQL for several
ways to model these things in SQL. But what you are trying to do is
force an OO model into SQL and it is not a good idea. There are no
classes or links in RDBMS; we have tables and references. We do not
mix data and metadata in a schema. The data model does not change
during the application.

Many years ago, the INCITS H2 Database Standards Committee(nee ANSI
X3H2 Database Standards Committee) had a meeting in Rapid City, South
Dakota. We had Mount Rushmore and Bjarne Stroustrup as special
attractions. Mr. Stroustrup did his slide show about Bell Labs
inventing C++ and OO programming for us and we got to ask questions.

One of the questions was how we should put OO stuff into SQL. His
answer was that Bells Labs, with all their talent, had tried four
different approaches to this problem and come the conclusion that you
should not do it. OO was great for programming but deadly for data.

I have watched people try to force OO models into SQL and it falls
apart in about a year. Every typo becomes a new attribute or class,
queries that would have been so easy in a relational model are now
multi-table monster outer joins, redundancy grows at an exponential
rates, constraints are virtually impossible to write so you can kiss
data integrity goodbye, etc.|||Thanks for your reply. I actually bought your book a couple of weeks
ago, which led to my choosing the nested set implementation. Great
book, I'd recommend it to anyone looking for a good summary of the
various methods of modelling trees in SQL. I guess my problem is not
how to model the tree itself given that I have the book, but rather how
to persist what is obviously an already built OO model in a RDBMS. I'm
sure your statements about the problems of mixing metadata and data
will hold true, but how can I persist my dynamic nodes without doing
this? I suppose I could use an XML file to map specific tables to
their respective nodes, but this doesn't seem like a more elegant
solution given, and in this case I might as well store the entire tree
structure in XML. Given that the trees will be > 10000 nodes on
average, I think an efficient XML solution is out. Any further
suggestions would be appreciated - thanks,

Bob Yohan|||The classic scenario calls for a root class with all the common
attributes and then specialized sub-classes under it. As an example,
let's take the class of Vehicles and find an industry standard
identifier (VIN), and add two mutually exclusive sub-classes, Sport
utility vehicles and sedans ('SUV', 'SED').

CREATE TABLE Vehicles
(vin CHAR(17) NOT NULL PRIMARY KEY,
vehicle_type CHAR(3) NOT NULL
CHECK(vehicle_type IN ('SUV', 'SED')),
UNIQUE (vin, vehicle_type),
..);

Notice the overlapping candidate keys. I then use a compound candidate
key (vin, vehicle_type) and a constraint in each sub-class table to
assure that the vehicle_type is locked and agrees with the Vehicles
table. Add some DRI actions and you are done:

CREATE TABLE SUV
(vin CHAR(17) NOT NULL PRIMARY KEY,
vehicle_type CHAR(3) DEFAULT 'SUV' NOT NULL
CHECK(vehicle_type = 'SUV'),
UNIQUE (vin, vehicle_type),
FOREIGN KEY (vin, vehicle_type)
REFERENCES Vehicles(vin, vehicle_type)
ON UPDATE CASCADE
ON DELETE CASCADE,
..);

CREATE TABLE Sedans
(vin CHAR(17) NOT NULL PRIMARY KEY,
vehicle_type CHAR(3) DEFAULT 'SED' NOT NULL
CHECK(vehicle_type = 'SED'),
UNIQUE (vin, vehicle_type),
FOREIGN KEY (vin, vehicle_type)
REFERENCES Vehicles(vin, vehicle_type)
ON UPDATE CASCADE
ON DELETE CASCADE,
..);

I can continue to build a hierarchy like this. For example, if I had a
Sedans table that broke down into two-door and four-door sedans, I
could a schema like this:

CREATE TABLE Sedans
(vin CHAR(17) NOT NULL PRIMARY KEY,
vehicle_type CHAR(3) DEFAULT 'SED' NOT NULL
CHECK(vehicle_type IN ('2DR', '4DR', 'SED')),
UNIQUE (vin, vehicle_type),
FOREIGN KEY (vin, vehicle_type)
REFERENCES Vehicles(vin, vehicle_type)
ON UPDATE CASCADE
ON DELETE CASCADE,
..);

CREATE TABLE TwoDoor
(vin CHAR(17) NOT NULL PRIMARY KEY,
vehicle_type CHAR(3) DEFAULT '2DR' NOT NULL
CHECK(vehicle_type = '2DR'),
UNIQUE (vin, vehicle_type),
FOREIGN KEY (vin, vehicle_type)
REFERENCES Sedans(vin, vehicle_type)
ON UPDATE CASCADE
ON DELETE CASCADE,
..);

CREATE TABLE FourDoor
(vin CHAR(17) NOT NULL PRIMARY KEY,
vehicle_type CHAR(3) DEFAULT '4DR' NOT NULL
CHECK(vehicle_type = '4DR'),
UNIQUE (vin, vehicle_type),
FOREIGN KEY (vin, vehicle_type)
REFERENCES Sedans (vin, vehicle_type)
ON UPDATE CASCADE
ON DELETE CASCADE,
..);

The idea is to build a chain of identifiers and types in a UNIQUE()
constraint that go up the tree when you use a REFERENCES constraint.
Obviously, you can do variants of this trick to get different class
structures.

If an entity doesn't have to be exclusively one subtype, you play with
the root of the class hierarchy:

CREATE TABLE Vehicles
(vin CHAR(17) NOT NULL,
vehicle_type CHAR(3) NOT NULL
CHECK(vehicle_type IN ('SUV', 'SED')),
PRIMARY KEY (vin, vehicle_type),
..);

Now start hiding all this stuff in VIEWs immediately and add an INSTEAD
OF trigger to those VIEWs. Performance will suck and the code will be
a pain to maintain, but it is possible.|||Thank you Joe - you've been very helpful. Keep up the good work,

Bob

Friday, March 23, 2012

permissions problems

Hi,
I've made a mistake that is causing big problems and hope someone can help
me solve this problem:
When I reattached my database files after a rebuild to the server, somehow
the permissions for accounts, including sa, are not right. Here are two
examples: one database is maintained through an MS Access front end. All
the code needed to be changed to add the owner qualifier to the table names
in order to work. I am working with a second database today. If I access
it through Enterprise Mgr I can insert records into any tables fine, but if
I link the tables in access using same username and pw, I can only read, not
insert or update.
I'm very new at SQL Server admin. can someone help me to figure out what I
did wrong when I reattached the databases or reinstalled the new instance of
SQL Server on the machine?
Thanks,
CherylWow.. I'm not sure I completely follow, but let me give you a quick rundown
on the SQL Server side and maybe it will help you with your problems.
In SQL Server, you have a system login ID which is stored in the master
database in a table called sysxlogins. This id is created by you in the
Security folder in Enterprise Manager.
This allows you access to SQL Server, but not to any databases. To gain
access to a database, that login ID must be mapped into a database. Every
database has a table in it called sysusers. This sysusers table will have
the mapped login id from the master databases's sysxlogins table.
When you rebuild the system and recreate your databases, or reattach them,
you can run in to problems. This is especially true when the master
database has been recreated for some reason and you are not supplying a
backup.
If you create the following login ID's in SQL Server in the following order:
1. Frogger
2. Kermit
3. BigBird
They will have sysxlogin ids of 1, 2 and 3 (just an example folks)
If you then map these into your LilyPad database as the users:
Frogger
Kermit
BigBird
Then the sysusers table will have 1, 2 and 3 respectively.
You then assign permissions to those database users.
If you then detach your databases and move them to a different server and
reattach them, the following happens.
1. The database users are still there, however they no longer map to login
id's from sysxlogins because sysxlogins is in the old master database on the
other server.
You recreate the ID's on your new server, but do so in the following order:
1. BigBird
2. Frogger
3. Kermit
The ID's are now there, but they still do not match your database user ids.
In order to complete the process, you have to match up these new ID's from
sysxlogins with the database users.
To do so, you need to run sp_change_users_login for each ID and in each
database.
HTH
Rick Sawtell|||An excellent explanation by Rick.
If you have created the logins with the same names as before the rebuild,
you can use the following code to link the orphaned users. Run the code in
QA from the DB of your concern.
exec master.dbo.sp_configure @.configname = 'allow updates', @.configvalue =1
RECONFIGURE WITH OVERRIDE
GO
update sysusers set sid = l.sid
from sysusers u
inner join master.dbo.syslogins l
on u.name = l.name
exec master.dbo.sp_configure @.configname = 'allow updates', @.configvalue =0
RECONFIGURE WITH OVERRIDE
"Rick Sawtell" <r_sawtell@.hotmail.com> wrote in message
news:eOyBINomEHA.2616@.tk2msftngp13.phx.gbl...
> Wow.. I'm not sure I completely follow, but let me give you a quick
rundown
> on the SQL Server side and maybe it will help you with your problems.
> In SQL Server, you have a system login ID which is stored in the master
> database in a table called sysxlogins. This id is created by you in the
> Security folder in Enterprise Manager.
> This allows you access to SQL Server, but not to any databases. To gain
> access to a database, that login ID must be mapped into a database.
Every
> database has a table in it called sysusers. This sysusers table will have
> the mapped login id from the master databases's sysxlogins table.
> When you rebuild the system and recreate your databases, or reattach them,
> you can run in to problems. This is especially true when the master
> database has been recreated for some reason and you are not supplying a
> backup.
> If you create the following login ID's in SQL Server in the following
order:
> 1. Frogger
> 2. Kermit
> 3. BigBird
> They will have sysxlogin ids of 1, 2 and 3 (just an example folks)
> If you then map these into your LilyPad database as the users:
> Frogger
> Kermit
> BigBird
> Then the sysusers table will have 1, 2 and 3 respectively.
> You then assign permissions to those database users.
> If you then detach your databases and move them to a different server and
> reattach them, the following happens.
> 1. The database users are still there, however they no longer map to
login
> id's from sysxlogins because sysxlogins is in the old master database on
the
> other server.
> You recreate the ID's on your new server, but do so in the following
order:
> 1. BigBird
> 2. Frogger
> 3. Kermit
> The ID's are now there, but they still do not match your database user
ids.
> In order to complete the process, you have to match up these new ID's from
> sysxlogins with the database users.
> To do so, you need to run sp_change_users_login for each ID and in each
> database.
>
> HTH
> Rick Sawtell
>|||Yikes. I think you're right - that's exactly what I did (or failed to do!).
I'll try your suggestion and see if it fixes the mess I've created.
Thanks very much for your help,
Cheryl
"Rick Sawtell" <r_sawtell@.hotmail.com> wrote in message
news:eOyBINomEHA.2616@.tk2msftngp13.phx.gbl...
> Wow.. I'm not sure I completely follow, but let me give you a quick
rundown
> on the SQL Server side and maybe it will help you with your problems.
> In SQL Server, you have a system login ID which is stored in the master
> database in a table called sysxlogins. This id is created by you in the
> Security folder in Enterprise Manager.
> This allows you access to SQL Server, but not to any databases. To gain
> access to a database, that login ID must be mapped into a database.
Every
> database has a table in it called sysusers. This sysusers table will have
> the mapped login id from the master databases's sysxlogins table.
> When you rebuild the system and recreate your databases, or reattach them,
> you can run in to problems. This is especially true when the master
> database has been recreated for some reason and you are not supplying a
> backup.
> If you create the following login ID's in SQL Server in the following
order:
> 1. Frogger
> 2. Kermit
> 3. BigBird
> They will have sysxlogin ids of 1, 2 and 3 (just an example folks)
> If you then map these into your LilyPad database as the users:
> Frogger
> Kermit
> BigBird
> Then the sysusers table will have 1, 2 and 3 respectively.
> You then assign permissions to those database users.
> If you then detach your databases and move them to a different server and
> reattach them, the following happens.
> 1. The database users are still there, however they no longer map to
login
> id's from sysxlogins because sysxlogins is in the old master database on
the
> other server.
> You recreate the ID's on your new server, but do so in the following
order:
> 1. BigBird
> 2. Frogger
> 3. Kermit
> The ID's are now there, but they still do not match your database user
ids.
> In order to complete the process, you have to match up these new ID's from
> sysxlogins with the database users.
> To do so, you need to run sp_change_users_login for each ID and in each
> database.
>
> HTH
> Rick Sawtell
>|||Cheryl,
Also, search KB for sp_help_rev_logins. With this you can create logins on the destination server
with the same SID as on the originating server.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Cheryl" <cr1ce@.comcast.net> wrote in message news:ci7heu$in7$1@.scrotar.nss.udel.edu...
> Yikes. I think you're right - that's exactly what I did (or failed to do!).
> I'll try your suggestion and see if it fixes the mess I've created.
> Thanks very much for your help,
> Cheryl
>
> "Rick Sawtell" <r_sawtell@.hotmail.com> wrote in message
> news:eOyBINomEHA.2616@.tk2msftngp13.phx.gbl...
>> Wow.. I'm not sure I completely follow, but let me give you a quick
> rundown
>> on the SQL Server side and maybe it will help you with your problems.
>> In SQL Server, you have a system login ID which is stored in the master
>> database in a table called sysxlogins. This id is created by you in the
>> Security folder in Enterprise Manager.
>> This allows you access to SQL Server, but not to any databases. To gain
>> access to a database, that login ID must be mapped into a database.
> Every
>> database has a table in it called sysusers. This sysusers table will have
>> the mapped login id from the master databases's sysxlogins table.
>> When you rebuild the system and recreate your databases, or reattach them,
>> you can run in to problems. This is especially true when the master
>> database has been recreated for some reason and you are not supplying a
>> backup.
>> If you create the following login ID's in SQL Server in the following
> order:
>> 1. Frogger
>> 2. Kermit
>> 3. BigBird
>> They will have sysxlogin ids of 1, 2 and 3 (just an example folks)
>> If you then map these into your LilyPad database as the users:
>> Frogger
>> Kermit
>> BigBird
>> Then the sysusers table will have 1, 2 and 3 respectively.
>> You then assign permissions to those database users.
>> If you then detach your databases and move them to a different server and
>> reattach them, the following happens.
>> 1. The database users are still there, however they no longer map to
> login
>> id's from sysxlogins because sysxlogins is in the old master database on
> the
>> other server.
>> You recreate the ID's on your new server, but do so in the following
> order:
>> 1. BigBird
>> 2. Frogger
>> 3. Kermit
>> The ID's are now there, but they still do not match your database user
> ids.
>> In order to complete the process, you have to match up these new ID's from
>> sysxlogins with the database users.
>> To do so, you need to run sp_change_users_login for each ID and in each
>> database.
>>
>> HTH
>> Rick Sawtell
>>
>|||Ohhhh...
Forgot about that one Tibor.
Thanks!
Rick
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:%23Pg0TMpmEHA.3392@.TK2MSFTNGP15.phx.gbl...
> Cheryl,
> Also, search KB for sp_help_rev_logins. With this you can create logins on
the destination server
> with the same SID as on the originating server.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Cheryl" <cr1ce@.comcast.net> wrote in message
news:ci7heu$in7$1@.scrotar.nss.udel.edu...
> > Yikes. I think you're right - that's exactly what I did (or failed to
do!).
> > I'll try your suggestion and see if it fixes the mess I've created.
> >
> > Thanks very much for your help,
> > Cheryl
> >
> >
> >
> > "Rick Sawtell" <r_sawtell@.hotmail.com> wrote in message
> > news:eOyBINomEHA.2616@.tk2msftngp13.phx.gbl...
> >> Wow.. I'm not sure I completely follow, but let me give you a quick
> > rundown
> >> on the SQL Server side and maybe it will help you with your problems.
> >>
> >> In SQL Server, you have a system login ID which is stored in the master
> >> database in a table called sysxlogins. This id is created by you in
the
> >> Security folder in Enterprise Manager.
> >>
> >> This allows you access to SQL Server, but not to any databases. To
gain
> >> access to a database, that login ID must be mapped into a database.
> > Every
> >> database has a table in it called sysusers. This sysusers table will
have
> >> the mapped login id from the master databases's sysxlogins table.
> >>
> >> When you rebuild the system and recreate your databases, or reattach
them,
> >> you can run in to problems. This is especially true when the master
> >> database has been recreated for some reason and you are not supplying a
> >> backup.
> >>
> >> If you create the following login ID's in SQL Server in the following
> > order:
> >>
> >> 1. Frogger
> >> 2. Kermit
> >> 3. BigBird
> >>
> >> They will have sysxlogin ids of 1, 2 and 3 (just an example folks)
> >>
> >> If you then map these into your LilyPad database as the users:
> >> Frogger
> >> Kermit
> >> BigBird
> >>
> >> Then the sysusers table will have 1, 2 and 3 respectively.
> >> You then assign permissions to those database users.
> >>
> >> If you then detach your databases and move them to a different server
and
> >> reattach them, the following happens.
> >>
> >> 1. The database users are still there, however they no longer map to
> > login
> >> id's from sysxlogins because sysxlogins is in the old master database
on
> > the
> >> other server.
> >>
> >> You recreate the ID's on your new server, but do so in the following
> > order:
> >>
> >> 1. BigBird
> >> 2. Frogger
> >> 3. Kermit
> >>
> >> The ID's are now there, but they still do not match your database user
> > ids.
> >>
> >> In order to complete the process, you have to match up these new ID's
from
> >> sysxlogins with the database users.
> >>
> >> To do so, you need to run sp_change_users_login for each ID and in each
> >> database.
> >>
> >>
> >> HTH
> >>
> >> Rick Sawtell
> >>
> >>
> >
> >
>sql

Friday, March 9, 2012

Permissions

Hi
How to solve next problem
a) I have database TEST
b) Login and user - webguest
Now i need set SELECT permission to all tables and views and INSERT,UPDATE,
DELETE perimissions
on couple tables.
I have tried management studio but no luck )
Regards;
Red
Hi
Is 'webguest' member of db_owner database role? Add him to this role
"Redivivus" <meelis.lilbok@.deltmar.ee> wrote in message
news:uGnVUsEdHHA.3632@.TK2MSFTNGP02.phx.gbl...
> Hi
> How to solve next problem
> a) I have database TEST
> b) Login and user - webguest
> Now i need set SELECT permission to all tables and views and
> INSERT,UPDATE, DELETE perimissions
> on couple tables.
> I have tried management studio but no luck )
>
> Regards;
> Red
>
|||yes webguest is db_owner
but setting all permissions manually is veeeery hard there are over 100
tables in db.
how to set GRANT SELECT all tables and DENY UPDATE,INSERT,DELETE to all
tables
and then manually set GRANT INSERT, UPDATE, DELETE to specific tables
Red.
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:elI30eFdHHA.4188@.TK2MSFTNGP02.phx.gbl...
> Hi
> Is 'webguest' member of db_owner database role? Add him to this role
> "Redivivus" <meelis.lilbok@.deltmar.ee> wrote in message
> news:uGnVUsEdHHA.3632@.TK2MSFTNGP02.phx.gbl...
>
|||You can run the following select statement within the database you wish to
grant the permission to - then execute the resulting code.
select 'grant select,insert,update,delete on ' + name + ' to webguest' +
char(13) + ';' from sysobjects where xtype in( 'U','V')
Thanks,
Scott H.
"Redivivus" wrote:

> Hi
> How to solve next problem
> a) I have database TEST
> b) Login and user - webguest
> Now i need set SELECT permission to all tables and views and INSERT,UPDATE,
> DELETE perimissions
> on couple tables.
> I have tried management studio but no luck )
>
> Regards;
> Red
>
>

Permissions

Hi
How to solve next problem
a) I have database TEST
b) Login and user - webguest
Now i need set SELECT permission to all tables and views and INSERT,UPDATE,
DELETE perimissions
on couple tables.
I have tried management studio but no luck )
Regards;
RedHi
Is 'webguest' member of db_owner database role? Add him to this role
"Redivivus" <meelis.lilbok@.deltmar.ee> wrote in message
news:uGnVUsEdHHA.3632@.TK2MSFTNGP02.phx.gbl...
> Hi
> How to solve next problem
> a) I have database TEST
> b) Login and user - webguest
> Now i need set SELECT permission to all tables and views and
> INSERT,UPDATE, DELETE perimissions
> on couple tables.
> I have tried management studio but no luck )
>
> Regards;
> Red
>|||yes webguest is db_owner
but setting all permissions manually is veeeery hard there are over 100
tables in db.
how to set GRANT SELECT all tables and DENY UPDATE,INSERT,DELETE to all
tables
and then manually set GRANT INSERT, UPDATE, DELETE to specific tables
Red.
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:elI30eFdHHA.4188@.TK2MSFTNGP02.phx.gbl...
> Hi
> Is 'webguest' member of db_owner database role? Add him to this role
> "Redivivus" <meelis.lilbok@.deltmar.ee> wrote in message
> news:uGnVUsEdHHA.3632@.TK2MSFTNGP02.phx.gbl...
>|||You can run the following select statement within the database you wish to
grant the permission to - then execute the resulting code.
select 'grant select,insert,update,delete on ' + name + ' to webguest' +
char(13) + ';' from sysobjects where xtype in( 'U','V')
--
Thanks,
Scott H.
"Redivivus" wrote:

> Hi
> How to solve next problem
> a) I have database TEST
> b) Login and user - webguest
> Now i need set SELECT permission to all tables and views and INSERT,UPDATE
,
> DELETE perimissions
> on couple tables.
> I have tried management studio but no luck )
>
> Regards;
> Red
>
>

Permissions

Hi
How to solve next problem
a) I have database TEST
b) Login and user - webguest
Now i need set SELECT permission to all tables and views and INSERT,UPDATE,
DELETE perimissions
on couple tables.
I have tried management studio but no luck :))
Regards;
RedHi
Is 'webguest' member of db_owner database role? Add him to this role
"Redivivus" <meelis.lilbok@.deltmar.ee> wrote in message
news:uGnVUsEdHHA.3632@.TK2MSFTNGP02.phx.gbl...
> Hi
> How to solve next problem
> a) I have database TEST
> b) Login and user - webguest
> Now i need set SELECT permission to all tables and views and
> INSERT,UPDATE, DELETE perimissions
> on couple tables.
> I have tried management studio but no luck :))
>
> Regards;
> Red
>|||yes webguest is db_owner
but setting all permissions manually is veeeery hard there are over 100
tables in db.
how to set GRANT SELECT all tables and DENY UPDATE,INSERT,DELETE to all
tables
and then manually set GRANT INSERT, UPDATE, DELETE to specific tables
Red.
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:elI30eFdHHA.4188@.TK2MSFTNGP02.phx.gbl...
> Hi
> Is 'webguest' member of db_owner database role? Add him to this role
> "Redivivus" <meelis.lilbok@.deltmar.ee> wrote in message
> news:uGnVUsEdHHA.3632@.TK2MSFTNGP02.phx.gbl...
> > Hi
> >
> > How to solve next problem
> >
> > a) I have database TEST
> > b) Login and user - webguest
> > Now i need set SELECT permission to all tables and views and
> > INSERT,UPDATE, DELETE perimissions
> > on couple tables.
> >
> > I have tried management studio but no luck :))
> >
> >
> > Regards;
> > Red
> >
>|||You can run the following select statement within the database you wish to
grant the permission to - then execute the resulting code.
select 'grant select,insert,update,delete on ' + name + ' to webguest' +
char(13) + ';' from sysobjects where xtype in( 'U','V')
--
Thanks,
Scott H.
"Redivivus" wrote:
> Hi
> How to solve next problem
> a) I have database TEST
> b) Login and user - webguest
> Now i need set SELECT permission to all tables and views and INSERT,UPDATE,
> DELETE perimissions
> on couple tables.
> I have tried management studio but no luck :))
>
> Regards;
> Red
>
>