user3165438
user3165438

Reputation: 2661

Generic query for any DB

I've created a query available for the Oracle and Access DB. The query is a simple select experssion includes wild cards.

string query = @"SELECT t_package.Package_ID FROM t_package   
                WHERE t_package.PackageFlags   
                LIKE '#WC#VCCFG=#WC#CheckedOutTo=#WC#'";  

//set the wild card according to the DBMS type that current repository based on.
  string wildCardCharacter = "";
  wildCardCharacter = RepositoryType().Contains("Access") == true? "*" : "%";

//Replace wild card characters with the appropriate one.
  query = query.Replace("#WC#", wildCardCharacter);

I would like the query to be suitable also for the following databases:

• MS SQL Server
• MySQL
• Oracle9i and 10g
• PostgreSQL
• MSDE
• Adaptive Server Anywhere
• Progress OpenEdge

Any ideas how to set the appropriate wild cards for each?

Upvotes: 0

Views: 289

Answers (1)

dnoeth
dnoeth

Reputation: 60482

Afaik only Access is not using Standard SQL * and _ as LIKE wildcards (I'm not shure about Progess OpenEdge)

Upvotes: 1

Related Questions