[quoted text, click to view] "James_101" <James101@discussions.microsoft.com> wrote in message
news:3FEFA833-FC8C-4D0E-A022-110D16116E9D@microsoft.com...
>I am developing a database on my desktop using Developers Edition of SQL
> Server 2000. The database will ultimately be sent to my client to run on
> his
> db server. I would like for a specified employee at the client to be able
> to
> modify data, add records and delete records.
>
> I understand that these actions can be taken using a view. I created a
> view
> in Query Analyzer with this code:
>
> USE DatabaseName
> GO
> CREATE VIEW ViewName
> AS SELECT * FROM TableName
> GO
>
> I ran the view in Query Analyzer. The view looks OK but I am unable to
> modify data. I am the administrator on my desktop. What should I do
> differently?
>
What does "unable to modify data" mean? Do you get an error message and if
so what is it?
One reason may be that you don't have a primary key or unique index on this
table. QA doesn't allow you to modify the data unless you have a unique key.
Do not use "SELECT *" in any production code, especially not in views.
SELECT * is generally bad because it harms performance and makes code harder
to maintain. It is also dangerous in a view because the view won't refresh
the column list if the table changes. If you drop and then add a column or
if you rename a column then you'll find you get phantom columns in the view
with the wrong name.
--
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--