Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Not able to insert a particular value Expand / Collapse
Author
Message
Posted Thursday, July 26, 2012 2:01 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Monday, June 16, 2014 4:52 AM
Points: 885, Visits: 257
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
Posted Thursday, July 26, 2012 2:03 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Yesterday @ 2:26 PM
Points: 2,422, Visits: 7,437
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
Posted Thursday, July 26, 2012 2:12 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 9:56 AM
Points: 7,120, Visits: 13,491
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
Posted Thursday, July 26, 2012 4:48 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, June 24, 2014 6:38 PM
Points: 1,371, Visits: 1,560
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
Posted Wednesday, August 8, 2012 5:26 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Monday, June 16, 2014 4:52 AM
Points: 885, Visits: 257
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 »

Add to briefcase

Permissions Expand / Collapse