Not able to insert a particular value

  • 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

  • Could be a constraint on the table.


    Forever trying to learn
    My blog - http://www.cadavre.co.uk/
    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/

  • 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

  • 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[/url]
    Guidelines for answers on Performance questions

    Link to my Blog Post --> www.SQLPathy.com[/url]

    Follow me @Twitter

  • I got the answer. It is because am checking this condition for status in one of the triggers..

    Thanks to All

    Thanks

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply