Insert not inserting the correct value

onaled777
onaled777 used Ask the Experts™
on
I have a working knowledge of SQL Server, but I am not an expert.  I wonder if you could give me reasons for a strange observed behavior.

I do a simple insert on a table as shown in the codebase below.  Notice the Archived is to be set to one. When I run the query however, and then do a select to see the result, the Archived is set to 0 in the database.

What are some possbile reasons for this?
INSERT INTO PG
					(
						pgtypeid
						, pgstatusid
						, websiteid
						, description
						, url
						, landingpgflag
						, formsubmissionflag
						, luby
						, lu
						, disabled_ind
						, Archived
				)VALUES(
						2
						, 5
						, 18
						, 'Description'
						, 'PageName'
						, 1
						, 1
						, 'Team'
						, GetDate()
						, 0
						, 1
					)

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
I don't see anything wrong in your INSERT statement. somebody might have update the value or/else you might have trigger which is changing the value.

Author

Commented:
Thanks RiteshShah

Author

Commented:
I am pretty sure no one modified, since I am the only one working in this database at the moment, but is a trigger the only thing that could trigger it?  Could there be a configuration on the table, or a constraint that could be set that only allows a certain value? Just asking, I will award the points regardless.
you can see whether any trigger defined on that table or not with the help of following link from my blog.

http://www.sqlhub.com/2010/01/spdepends-is-very-useful-stored.html

all the dependent object of the table you will get from the two ways defined on above link

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial