mardi 27 juillet 2021

I have a database Probate.In this database i want to show datatypes with character length with nvarchar, varchar datatypes but float and int datatypes

i have a database Probate. In this database i want to show all the tables with names column names and datatypes and i concat datatype and character maximum length with paranthesis.when i use concat function i got desired things but i want where datatype is float or int exist the float and int and other datatypes that exist alone should not enclose with paranthesis

SELECT TABLE_SCHEMA, 
       TABLE_NAME, 
       COLUMN_NAME, 
       Concat(DATA_TYPE,CHARACTER_MAXIMUM_LENGTH) 
FROM  INFORMATION_SCHEMA.COLUMNS
ORDER BY table_schema,table_name;

I run this query it show me all the tables with their names, column names, datatypes but it include paranthesis with float and int datatypes that does not contain any Character length. Now i want to show that paranthesis are used with datatypes that have character length.

Aucun commentaire:

Enregistrer un commentaire