What is an "X"?

sSQL.Append(" SELECT 'X' "); sSQL.Append(" FROM ProfileInsurancePlanYear "); sSQL.Append(" WHERE ProfileID = " + profileid.ToString() + " AND CropYear = " + cropyear.ToString()); 

This was a request that initially hit the end of access. I translated it into SQLCE and wondered what this request should do.

The structure of the table in which it falls:

 ProfileID InsurancePlanID CropYear INsurance_Price Levels_XML 

I assume this will select something from the Levels_XML column where profiles and crop will be matched?

Does this work even in sqlCE?

+4
source share
1 answer

This type of query is usually used to see if a string exists. If a string is found, the query will return a single X. Otherwise, it will be an empty result set ... You can also say

  sSQL.Append(" SELECT count(*) "); sSQL.Append(" FROM ProfileInsurancePlanYear "); sSQL.Append(" WHERE ProfileID = " + profileid.ToString() + " AND CropYear = " + cropyear.ToString()); 

A result will be returned with 0 or some positive number. The various approaches querying the database simply indicate if existing records exist matching the condition.

+9
source

All Articles