Tip 12 : Common T-SQL Escape Scenarios: Percent (%), Underscore (_)

Scenario 1 : You have a Purchase table with field named DiscountRate. The DiscountRate values can be true percentage such as "2.5%", "5.0%", or can be other values such as "N/A", "Fixed Rate", etc. You want all the records with true percentage.

To implement this, you need to escape percentage (%)

Scenario 2 : You have a Purchase table with fields of PurchaseType and Amount. The table uses vertical design. The PurchaseType values can be "xxxxx_gas", "xxxxx_food", etc. The "xxxxx" denotes value of a customer id. You want all the gasoline purchases, records ending with _gas.

To implement this, you need to escape underscore (_)

 

2 Comments

  • oui mais niet. Affirmatif parce que on rencontre d’autres sources qui se référent de semblables significations.
    Non parce que il n’est pas assez de répéter
    ce qu’on est en mesure de rencontrer avec certains site internet étrangers
    puis le transposer aussi naturellement:

  • Did I not mention that? Someone has put a hit on him, and he’s gonna find out
    who.

Comments have been disabled for this content.