开发者

Validate datatype of operands in a mathematical expression

I have to create a mathematical expression with column objec开发者_如何学Got as operands and validate the datatype of the operands. The column object represents a database column and consists of table name, column name and datatype. If the operand datatype is text or bool an error message should be displayed. How can this validation be done?


This is going to vary based on what database engine you are using, but for SQL Server, you could use this query to load column shema data to compare against:

SELECT COLUMN_NAME, IS_NULLABLE, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH
FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = @TABLE_NAME
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜