Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2003
    Posts
    55

    Angry Unanswered: Problem in queries

    Hi all,
    I am using SQL Server 2000.
    I have two databases (DB_FD, DB_TS) each database on a different server, a windows service is accessing DB_FD only, the service must update, insert, delete records from both databases, DB_FD can access the DB_TS database through a linked server. For each table in the DB_TS database there exists a simple view (select * from <linked_server_name>.<owner_name>.<table_name> ) in the DB_FD database.
    Now when I need to insert new records into the DB_TS database, my windows service in doing the insert statement through the views found in the DB_FD database.
    The problem is that, some times, when I select records from the view in the DB_FD database and compare them with the data exist in the base table of that view I discovered that they are not the same!!
    Besides, when executing an insert SQL statement against the view, it returns an error for primary key violation, while executing the same statement against the base table goes successfully. To solve the problem temporarily I used to drop and recreate the views, then the problem disappears for a limited time and then comes back again.
    I will be so grateful to any of you guys to tell me what the problem exactly is.

  2. #2
    Join Date
    Jul 2003
    Posts
    55

    Unhappy Re: Problem in queries

    Would any of you comment on this? I need to know if you did not get my question so that I can explain it more.



    Originally posted by RaedT
    Hi all,
    I am using SQL Server 2000.
    I have two databases (DB_FD, DB_TS) each database on a different server, a windows service is accessing DB_FD only, the service must update, insert, delete records from both databases, DB_FD can access the DB_TS database through a linked server. For each table in the DB_TS database there exists a simple view (select * from <linked_server_name>.<owner_name>.<table_name> ) in the DB_FD database.
    Now when I need to insert new records into the DB_TS database, my windows service in doing the insert statement through the views found in the DB_FD database.
    The problem is that, some times, when I select records from the view in the DB_FD database and compare them with the data exist in the base table of that view I discovered that they are not the same!!
    Besides, when executing an insert SQL statement against the view, it returns an error for primary key violation, while executing the same statement against the base table goes successfully. To solve the problem temporarily I used to drop and recreate the views, then the problem disappears for a limited time and then comes back again.
    I will be so grateful to any of you guys to tell me what the problem exactly is.
    Last edited by RaedT; 07-16-03 at 02:54.

  3. #3
    Join Date
    Jul 2003
    Posts
    55

    Re: Problem in queries

    No comments!!?

    Originally posted by RaedT
    Would any of you comment on this? I need to know if you did not get my question so that I can explain it more.

  4. #4
    Join Date
    May 2003
    Posts
    3

    Re: Problem in queries

    Originally posted by RaedT
    No comments!!?

    Hi,

    For the first problem, where you cannot see all the values through view, have you given any where condition while creating the view?

    For the second problem, try giving the column names while creating the view. Also provide the column name while inserting the values into the base table, through the view. Am not sure, if this helps, but give it a try.

    Thanks
    Yogish

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •