Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 View based on table modification

Author  Topic 

archana23
Yak Posting Veteran

89 Posts

Posted - 2013-08-08 : 17:16:17
I have been inserted one row in to table called as Teachers..

vTeachers is the View ctreated on Teachers Table.

When i Inserted one row in to Table Teachers i didnt see that row in vTeachers View.

How can i get that newly inserted values in to my View?

Can anyone please help me on this?

Thank you.

Archana

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-08-08 : 17:21:14
quote:
Originally posted by archana23

I have been inserted one row in to table called as Teachers..

vTeachers is the View ctreated on Teachers Table.

When i Inserted one row in to Table Teachers i didnt see that row in vTeachers View.

How can i get that newly inserted values in to my View?

Can anyone please help me on this?

Thank you.

Archana

You should see that row in vTeachers unless there is a WHERE clause on the view definition that is causing the new row to be filtered out. Take a look at the definition of vTeachers and see what kind of WHERE clause it has.

How are you observing that vTeachers did not show the new row? If you are using some front end GUI, it may be an artifact of that GUI. After you insert the row into Teachers, do a SELECT from teh vTeachers view.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-08-09 : 06:07:58
or it might be that View contains some logic which joins the result from Teachers tabel to someother table and your inserted row didnt have matching entry in joining table causing it to be ignored inside the view due to the join.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

archana23
Yak Posting Veteran

89 Posts

Posted - 2013-08-09 : 09:29:39
I tried to Insert same row in vTeachers View , it saying that 1 row affected but when i trying to retrive the data i am not getting anything?

Archana
Go to Top of Page

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-08-09 : 09:36:25
quote:
Originally posted by archana23

I tried to Insert same row in vTeachers View , it saying that 1 row affected but when i trying to retrive the data i am not getting anything?

Archana

Do two things:

1. Post the query or details of the method that you are using to retrieve the data from the vTeachers view. I am expecting to see something like a "SELECT * FROM vTeachers". If that is not what you are doing, then please give the details.

2. Open SQL Server Management Studio, and in object explorer, navigate to the view. It should be under the Servername -> DatabaseName -> Views. Right-click on it, and select Script View as -> Create to -> New Query Editor window. Post the script that will appear on your screen.
Go to Top of Page
   

- Advertisement -