jeudi 7 mars 2019

How can I generate random variables according to data types?

I have some databases and tables. I am trying to detect data types of each column and create random variables according to data type?


For example:

col1 : int
col2 : nvarchar(max)
col3 : bit

I need to detect each of the data types in code and create random variables for insert.

Should I create a methods, which check all data types and generate variables, for this work? like:

if(datatype.Equals("int"))
   random.Next();
else if(datatype.Equals("string"))
   ...

Is there any easy way?





Aucun commentaire:

Enregistrer un commentaire