Jump to content

SQL query results


ORSO2001

Recommended Posts

Dear All,

I am starting for the first time to work with DB in a server PC using SQL (SQL server) query.

I am using the SQL example...all works fine...I do the connection...I create the table...I am able to insert, update, get and cancel the "info" with this DB...what I saw and I don't understood is that if I send a query to have some information refered at a specific ID (...WHERE employeID =?) and this ID is not present in the DB the query result, BIT about query success, is turned as "1" ...I was expecting that the "fail BIT" arise !?

Maybe this is correct, sorry I don't know deeply this matter...can someone confirm?

thanks

Link to comment
Share on other sites

dear All,

ok...now that I better checked I saw that in the query with SELECT command its struct has description string about the result...when I ask for a not existing ID I have "Number of records 0"...I was expecting an "exception" error but ok...this is managed in this way.

Link to comment
Share on other sites

Well, from the point of view of the SQL Server / Client or the query, it succeeded (there query itself had the right syntax, and the tables and columns existed).

We don't parse the queries you execute, so we don't know what is going to be returned. 0 records doesn't mean fail, since "Delete From Table" would return 0 records, but is still OK.

Link to comment
Share on other sites

hi Saragani,

thanks for the answer...yes obviously you are right...thinking better I understood that I am asking to search if some element has a specific ID and the answer is "no one item has this ID"...then the request is done in correct way and also the answer is back in the correct format...thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.