KatherineF
Technical User
I need to check data types of values that have been entered from UI. I am going to create a stored proc that will take two parameters (@FieldName, @Value)
I have a table where I can get data types for @FieldName from.
SELECT @FieldType = FieldType
FROM TableName
WHERE FieldName = @FieldName
So by now I have @FieldName, @FieldType and @Value. @FieldType can be varchar, char, bit, int, long, datetime, etc.
I can't figure out the logic I have to use in order to compare data type of @Value and @FieldType.
The stored proc has to return true or false.
There are only two useful functions that I can use ISNUMERIC and ISDATE, but what about all other data types?
I have a table where I can get data types for @FieldName from.
SELECT @FieldType = FieldType
FROM TableName
WHERE FieldName = @FieldName
So by now I have @FieldName, @FieldType and @Value. @FieldType can be varchar, char, bit, int, long, datetime, etc.
I can't figure out the logic I have to use in order to compare data type of @Value and @FieldType.
The stored proc has to return true or false.
There are only two useful functions that I can use ISNUMERIC and ISDATE, but what about all other data types?