first write the query to check whether the value is already in the table or not using select * from table where value=yourValue, if resultset brings any record, means the value is already there and if not then you can insert one.
Otherwise apply a unique constraint on the column if you don't want the column to contain 2 or more same values.
One Hint, U could use subqueries with "Exist". Try using this. Search for Exist in sql server book online. You could get extensive write up on this with examples.
I dont think you are getting it right..if u have the data already in the table, it is going to be an update not an insert ...so you have to use and update statement...
assume u want to insert COBOL UPDATE table SET table_column_value = COBOL WHERE NOT EXISTS (SELECT * FROM table WHERE column_value = COBOL)
That query would replace all the entries which are not cobol to cobol. However my intension was to add the new entry after confirming that its not already present in the database.
Suppose if I had java,C#,VB. If I use your query it will replace everything with cobol. However what I want is if I enter cobol it should be inserted and avoid duplicates. When cobol is entered again, it should not accept it.
one of my friend told I may have to write a stored procedure for this... I am trying to find if there any other alternate solution like a nested query?