Updateable Vuew

Aug 14, 2005

I am hoping to create an updatable view from two tables joined on two
fields. I have two questions;

1. How can I enforce a one to one relation in sql server 2005 based on two
fields? Do I need to create one explicitly under relations? Do I cerate an
index on both fields? Is there a step by step process I can look at to
create one-one relations?

2. Is a view updateable if there is a where clause on one of the fields in
the join/relation?

Thank again.

Regards

View 1 Replies


ADVERTISEMENT

Updateable View

May 28, 2002

Hello-

I have a view that used to be updateable (except for a few fields, but that is fine). When I use the results of a CASE statement as one of the field values, the entire view is not updateable. The view is pasted below. Does anyone know how to keep my view updateable and, somehow, add this new field? Thank you.

-Eric


SELECT
DATEPART(yy, Orders.NextShipDate) AS year,
DATEPART(mm, Orders.NextShipDate) AS month,
DATEPART(dd, Orders.NextShipDate) AS day,
People.LastName,
People.FirstName,
Customers.CustomerID,
Orders.NextShipDate,
Customers.Custom,
Orders.AllocationTemp,
Orders.ShippingTemp,
Orders.HorseName,
Orders.PriorShipDate,
Customers.Username,
Customers.Password,
Orders.OrderID,
Orders.Deleted,
Orders.Deadbeat
FROM
People
INNER JOIN Customers
INNER JOIN Orders
ON Customers.CustomerID = Orders.CustomerID
ON People.PeopleID = Customers.PeopleID
WHERE
(CONVERT(DATETIME, CONVERT(CHAR(10), Orders.NextShipDate, 101)) <= DATEADD(d, 7, CURRENT_TIMESTAMP)) AND (Orders.Deleted = 0) AND
(Orders.Deadbeat = 0) AND
(Customers.Deleted = 0) AND
(Customers.Pending = 0) AND
(Orders.OrderID NOT IN
(SELECT Orders.OrderID
FROM Items INNER JOIN Products ON Items.ProductID = Products.ProductID INNER JOIN Orders ON Items.OrderID = Orders.OrderID
WHERE
(Items.Dose = 0) AND
(Products.IsPharmaceutical = 1) AND
(CONVERT(DATETIME, CONVERT(CHAR(10), Items.Created, 101)) > DATEADD(d, - 5, CURRENT_TIMESTAMP)) AND
(Items.Deleted = 0))) AND
EXISTS (SELECT ItemID FROM Items WHERE Items.OrderID = Orders.OrderID AND Deleted = 0)

View 1 Replies View Related

How To Tell If A VIEW Is Updateable

Oct 11, 2007

I could have swore I posted this earlier today, but it must not have went through...anyway here goes again.

Is there any way to tell if a view is updateable (updates the underlying table(s))?

Thanks,

Van

View 3 Replies View Related

Updateable View

Mar 24, 2008

I have a view that combines several tables, and lastly one column that is determined by a subquery.

i.e.
CREATE VIEW [View]
AS
SELECT
[TableA].*,
[TableB].*,
(SELECT TOP 1 [Column] FROM [TableC] ORDER BY [Column2])
AS [SpecialColumn]
FROM [TableA] INNER JOIN [TableB]
ON [TableA].[ColumnID] = [TableB].[ColumnID]

I have made INSTEAD OF UPDATE and INSTEAD OF INSERT triggers for this view that will then allow you to modify [View], and it will handle everything, adding/modifying the data in the three [TableX] tables accordingly.

In SQL Management Studio, the following code works fine, and is what is expected...

UPDATE [View] SET [SpecialColumn] = 1 WHERE [ColumnID] = @DesiredID

This will call my instead of trigger and update my special column accordingly exactly how I want it to.

Now, the problem lies in the application layer running on top of the database and how it accesses the view. Any call from the application to update [SpecialColumn] returns an OleDB error stating that [SpecialColumn] can not be modified. I assume that sql server is identifying the column as some sort of a derived column that normally wouldn't be able to be updated, and OleDB is restricting the column to just read only. Is there some way to override that in my view to say that the column is not read-only? Is this an OleDB restriction that can't be handled in the database/view itself?

I've also tried creating a stored procedure that called the exact same
UPDATE [View]
SET [SpecialColumn] = @param2
WHERE [ColumnID] = @param1
and it also works within management studio, but still gives a similar OleDB error about how the stored procedure attempts to update a derived column that can not be modified.

I have a solution where my stored procedure calls the exact same code as the instead of triggers to update the underlying tables of the view manually, however, I'm not asking for a solution like this to my problem, because this works fine, I simply am not happy having to do band-aid workarounds and am wondering if this is a common problem in front-ends and whether it can be handled on the database layer.

View 1 Replies View Related

Views Not Updateable

Mar 23, 2007

How do I make a view non updateable? I want to create a view so that Iwill not be able to update, insert or delete the view so that basetable is not affected (except dropping the view itself). Thanks.

View 4 Replies View Related

Browser Updateable Recordsets ?

Mar 26, 2000

I think it whould be simpler to explain what I am trying to accomplish.
I wish to pull a query to return multiple records from a SQL 7.0 database.
The query is a customers standing order.
I wish to make edits to multiple records then return those records for update.
The HTML pages that I have seen all seem to display tables on a singular record format.
Is it possible to display records in a 'Table' format and allow it to be updated.
Can any one answer this or direct me to a site with the relevent info.
Thanks Stuart
Indtec@eircom.net

View 2 Replies View Related

Conflicts In Updateable Subscriptions

Sep 11, 2007

I've been experiencing conflicts in my replication system that I can't seem to get my head around. The following is the scenario:

3 sqlservers, all running sql server 2005. Server B is the publisher and Server A and Server C (64 bit) are subscribers. The Queue Reader Agent runs on the publisher. I set up transactional repl with updateable subscriptions with the default conflict resolution policy of 'Publisher wins'.

There are 2 kinds of processes: 1. Nightly batch updates and 2. Daytime updates by real clients. The Nightly batch updates runs an on the publisher, which is B. Batch updates are massive updates and running it on the publisher makes sense and it works like a charm. Online updates are made on the subscriber 'C'. This subscriber is set to Queued update mode, and everyday I see a significant number of transactions that are detected as conflicts and the Publisher wins. As a result the changes made on Server C are getting lost. I have verified that no user/client is logged into Server B to do any updates. Users complain that their updates are lost. This is the most puzzling and frustrating bit. I don't see how a conflict can happen if nobody is updating data on the Publisher during the day. SQL Updates on Server C are getting rolled back on a conflict detection because the "Publisher wins", and SQL Inserts on server C are getting deleted because they don't exist on the publisher. Now, how can a insert done on the subscriber be marked as a conflict. There is no row on the publisher to compare the unique guid with, how can it be a conflict?

And the Queue Reader Agent crashes every 3-4 days. No useful information except it creates a dump file for which users have no tools to read it.


Has anyone seen this behavior ? Or is there a known bug in the QueueReader Agent?

My users are losing faith in the replication system and so am I.

Thanks for your time,
-chiraj.

View 3 Replies View Related

Updateable Transactional Replication

Mar 6, 2007

Will Sql Express handle being a subscriber for an updateable transactional publication from Sql Server 2005?

View 6 Replies View Related

Replication - Merge Vs Updateable Subscription

Feb 14, 2003

Does anyone have advice as choosing between merge replication and updatable subscriptions? I've read the documentaion, they seem to offer the same functionality, and I don't see any clear guidelines as to why to pick one over the other...any suggestions would be appreciated!

Ed

View 1 Replies View Related

Apply Sp4 For Updateable Transactional Replication

Jul 11, 2006

Hello,
We have two updateable subscribers and a publisher using transactional replication. The distributor is located on publisher. Currenetly all 3 sites are SQL 2000 SP3. We plan to upgrade all sites to sp4 with minimum downtime (if possible zero). Is it possible to upgrade publisher/distributor first and subscribers after few days?
Thanks,
np70

View 1 Replies View Related

Transactional Replication With Updateable Subscribers

Nov 28, 2005

Hi,

View 7 Replies View Related

Transactional With Updateable Subscription And Log Shipping

Mar 8, 2007

We have a database set up for transactional replication with an updateable subscription. When we add log shipping to the publication database (sending the logs to a separate server) the publication and subscription entry show up in Management Studio's replication folder on the log ship target server (although the definitions are correct).

Is this configuration legitimate? Can I add log shipping to the subscription database as well?

Thanks... Liston

View 4 Replies View Related

Synchronize Updateable Pull Subscription

Mar 5, 2007

I am using RMO to synchronize an updateable transactional pull subscription from Sql Express SP2 to Sql Server 2005 64-bit Standard Edition. The data propogates from the server to the client, but changed data on the client does not replicate to the server. Any ideas?

Thanks!

View 3 Replies View Related

Including SQL Server Allow Nulls Fields In Updateable Controls

Jun 13, 2006

When I include a field from my SQL Server database, which has it's Allow Nulls value checked, in the data source of any type of control with it's Enable Editing property check, I then can not edit the record!  If I remove the Allow Nulls field I can then edit it!  What am I missing here?

View 1 Replies View Related

MS SQL Server View Linked Into MSAccess Is Not Updateable Recordset

Jul 29, 2004

Hi All,
How can I link a view into MS Access from MS Sql Server, that I can update as a tabble.
Thanks
Laszlo

View 3 Replies View Related

Transactional Replication With Updateable Subscriptions And Identity Management

Oct 28, 2006

Replication Type: Transactional With Updateable Subscriptions
SQL Server Version: SQL Server 2005 Enterprise Edition
Publisher, Subscriber1 and Subscriber2 all on same SQL Server

Problem: I am trying to set up a transactional replication with two updateable subscriptions. All three databases are a carbon copy of each other. Every table to be replicated contains an identity key column. I've been asked to create the replication without assigning separate identity ranges for the publisher and the updateable subscriptions. In other words they want a continous ID range. Can this be done without managing identity ranges programatically outside of SQL Server itself?

Example:

Publisher inserts into table test1 in database1. This creates ID 100 for the record. ID 100 replicates to Subscriber1 (database2) and Subscriber2 (database3).
Subscriber1 and 2 identity seeds are then incremented to ID 100. So far, all three databases have the same identity seed in table test1. Subscriber1 inserts into table test1 in database2. This creates ID 101 for the record. ID 101 is replicated to Subscriber2 (database3) and to the publisher (database1).
Subscriber2 identity seed is then incremented to ID 101. However, the Publisher retains it's original identity seed of 100.
Insert into Publisher table test1 will fail since it will try to insert the identity seed of 101 which is taken.

I have tried identity range management Automatic and Manual. Both seem to have some limitations in managing identity seeds unless different identity ranges are assigned for publisher and subscriber.

Can someone recommend a solution to this problem? Can this be done natively in SQL Server 2005 replication. Or can some recommend another approach to make this work?




View 3 Replies View Related

SQLServer 2000 Connected To Access 2003 - Not Updateable

Mar 12, 2008

I have used the Access 2003 Upsize Wizard to create SQLServer Tables, all worked fine except I cannot Update the tables from Access.

The idea being to use Access Forms as the front end to an SQLserver back end as the Access database is quite complex and filled with macros and queries, not one of mine.

I can update the table in SQLServer but the connected tables at the Access end are read only. Why?


Kind regards,

Johnv

View 1 Replies View Related

Support For OLEDB Scrollable Updateable Cursor Via Query

Jul 5, 2007

Hi,

is there any update on the subject?

Jet has it for ages.



I want to use Scrollable/Updateable Cursors & OLEDB Rowsets opened via Select query.

Last time I have heard that MSFT is planning to add this in the future.



Is there a beta version that I can try?



Thanks,

Konstantin

View 8 Replies View Related

SQL Server 2008 :: Replication Articles Read-only AND Updateable At Same Time

Apr 21, 2015

We have many users with a mobile application running SQL Mobile and using merge replication to get data back to the SQL 2008 R2 database. This has worked very well for many years.

We now have a requirement to have this data reported on using Reporting Services. This is where it gets messy.

Due to a limitation of Report Builder(see this blog) we cannot provide access to users for creating their own reports. The report database is remote from the host and there is no VPN.

We hit upon the idea of creating an almost identical publication but the articles as read-only. It was only after this was done that we started having trouble with our existing mobile users.

It seems that a published article is EITHER Bi-directional OR Read-only even if they are in separate publications.

I then thought of using Transactional Publication but this too is blocked on creation with "automatic identity range support is useful only for publications that allow updating subscribers"(Merge and Transactional publication are mutually exclusive)

So in the final analysis is there a way for me to have merge replication AND some other form of SQL replication/data transfer that can have the same data transmitted readonly to a separate full SQL server database?

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved