Click here to Skip to main content
16,017,986 members

Comments by jateshs9 (Top 1 by date)

jateshs9 1-Mar-17 10:04am View    
Question: is_active is being renamed to isenabled which has datatype as bit in 0 or 1. It will never be as 2 as in your code. I have made changes based on my previous sentence.

1. Sorry to say this way, but either you didn't understood my question or you didn't look at my requirement properly as your query is wrong. Your query only checks whether isEnable is 0 or 1. But not whether name exist more than one or not.

2. I am not getting any error message I ran it myself in SQL Server and it works for @Enable = 0 but other cases. Command text was like a requirement to use instead of Stored Procedure. I am fully aware of having stored procedure but I had to do it this way.

3. Top 1 will only select one record. Let's say I am updating a name in row 4 with from "Dairy Products" to "Condiments". Here "Condiments" already exist in row 2. Therefore update should not occur and should return a message "Record exist in the table." This will not compare with other rows to check. If I am updating row 5 with itself changing the description it will show me the message 'Record exist in the table' and thus will not allow me to update the row itself.

Please see image for the point 3 as an example.