View Full Version : Dynamic SQL Question
I am creating a dynamic SQL program, if a user enters FIELDA = 123 on a WHERE statement, I want to determine if FIELDA is a character field or numeric so I can put quotes around it or not. I don't want the user to have to do that. What is the best way to do this? If an API is necessary, please provide a code snipit.
06-13-2005, 04:27 AM
There might be a better way but this will work: SELECT DBIITP, DBITYP FROM qadbifld WHERE dbilib = 'MYLIB' AND DBIFIL = 'MYFILE' AND DBIFLD = 'MYFIELD' Results would be something like this: INTERNAL FIELD TYPE TYPE A CHAR But IMO..... If a user is not familiar enough with the Database to know that a field is Char or Numeric..... allowing them to create free-format SQL statements might be "slightly" dangerous. Mike
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.