Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2008
»
T-SQL (SS2K8)
»
Not able to insert a particular value
Not able to insert a particular value
Rate Topic
Display Mode
Topic Options
Author
Message
deepzzzz
deepzzzz
Posted Thursday, July 26, 2012 2:01 AM
SSC Eights!
Group: General Forum Members
Last Login: Wednesday, April 24, 2013 4:23 AM
Points: 876,
Visits: 253
Hi,
Please find the below query
INSERT INTO tbl_employee (EmpNo,CompanyID,MngrID,DateOfFiled,DateOfClosed,DateOfCreation
,LastModified,Active,flag)
VALUES(
'2011-1508' ,89827,null,null,null,GETDATE(),GETDATE(),1,'C')
In the table, column 'Active' is of type int
I am not able to insert a value 1 to the table. But keeping the other values same, I am able to insert values for active. Eg:
INSERT INTO tbl_employee (EmpNo,CompanyID,MngrID,DateOfFiled,DateOfClosed,DateOfCreation
,LastModified,Active,flag)
VALUES(
'2011-1508' ,89827,null,null,null,GETDATE(),GETDATE(),2,'C')
Please let me know what will be the cause which is not allowing me to insert value 1?
Thanks
Post #1335608
Cadavre
Cadavre
Posted Thursday, July 26, 2012 2:03 AM
SSCrazy
Group: General Forum Members
Last Login: Thursday, May 16, 2013 9:16 AM
Points: 2,236,
Visits: 6,486
Could be a constraint on the table.
Not a DBA, just trying to learn
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better, quicker answers on SQL Server performance related questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
If you litter your database queries with nolock query hints, are you aware of the side effects?
Try reading a few of these links...
(*)
Missing rows with nolock
(*)
Allocation order scans with nolock
(*)
Consistency issues with nolock
(*)
Transient Corruption Errors in SQL Server error log caused by nolock
(*)
Dirty reads, read errors, reading rows twice and missing rows with nolock
LinkedIn
| Blog coming soon (for sufficiently large values of "soon"
)!
Post #1335609
ChrisM@Work
ChrisM@Work
Posted Thursday, July 26, 2012 2:12 AM
SSCertifiable
Group: General Forum Members
Last Login: Today @ 8:51 AM
Points: 5,608,
Visits: 10,970
deepzzzz (7/26/2012)
Hi,
Please find the below query
INSERT INTO tbl_employee (EmpNo,CompanyID,MngrID,DateOfFiled,DateOfClosed,DateOfCreation
,LastModified,Active,flag)
VALUES(
'2011-1508' ,89827,null,null,null,GETDATE(),GETDATE(),1,'C')
In the table, column 'Active' is of type int
I am not able to insert a value 1 to the table. But keeping the other values same, I am able to insert values for active. Eg:
INSERT INTO tbl_employee (EmpNo,CompanyID,MngrID,DateOfFiled,DateOfClosed,DateOfCreation
,LastModified,Active,flag)
VALUES(
'2011-1508' ,89827,null,null,null,GETDATE(),GETDATE(),2,'C')
Please let me know what will be the cause which is not allowing me to insert value 1?
What error message is generated when you attempt to enter 1 into [Active]?
“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.”
- Gail Shaw
For fast, accurate and documented assistance in answering your questions, please read
this article
.
Understanding and using APPLY, (I)
and
(II)
Paul White
Hidden RBAR: Triangular Joins
/
The "Numbers" or "Tally" Table: What it is and how it replaces a loop
Jeff Moden
Exploring Recursive CTEs by Example
Dwain Camps
Post #1335615
Lokesh Vij
Lokesh Vij
Posted Thursday, July 26, 2012 4:48 AM
Ten Centuries
Group: General Forum Members
Last Login: Today @ 11:26 AM
Points: 1,173,
Visits: 1,249
deepzzzz (7/26/2012)
Hi,
Please find the below query
INSERT INTO tbl_employee (EmpNo,CompanyID,MngrID,DateOfFiled,DateOfClosed,DateOfCreation
,LastModified,Active,flag)
VALUES(
'2011-1508' ,89827,null,null,null,GETDATE(),GETDATE(),1,'C')
In the table, column 'Active' is of type int
I am not able to insert a value 1 to the table. But keeping the other values same, I am able to insert values for active. Eg:
INSERT INTO tbl_employee (EmpNo,CompanyID,MngrID,DateOfFiled,DateOfClosed,DateOfCreation
,LastModified,Active,flag)
VALUES(
'2011-1508' ,89827,null,null,null,GETDATE(),GETDATE(),2,'C')
Please let me know what will be the cause which is not allowing me to insert value 1?
Kindly post the table definition along with the error message that you are getting.
~ Lokesh Vij
Guidelines for quicker answers on T-SQL question
Guidelines for answers on Performance questions
Link to my Blog Post -->
www.SQLPathy.com
Follow me
@Twitter
Post #1335687
deepzzzz
deepzzzz
Posted Wednesday, August 08, 2012 5:26 AM
SSC Eights!
Group: General Forum Members
Last Login: Wednesday, April 24, 2013 4:23 AM
Points: 876,
Visits: 253
I got the answer. It is because am checking this condition for status in one of the triggers..
Thanks to All
Thanks
Post #1341797
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.