A community member has associated this post with a similar question:
Azure Data Studio: Querying information based on the imported flat file.

Only moderators can edit this content.

SQL Query that looks for ID number

Sherlan Emmanuel Burgonia 86 Reputation points
2022-09-20T23:42:57.64+00:00

I was given a list of ID in string format and extract information from the database based on the ID number. However, these IDs in the database start with either '001' or '002'. Initially, I'm using WHERE ID IN ('0016085','0026085') to find it but I think there's a more efficient way instead of hardcoding both scenarios.

243207-image.png

TABLE
243223-image.png

Azure SQL Database
Developer technologies | Transact-SQL
Developer technologies | Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
SQL Server | Other
{count} votes

3 answers

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  3. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more