How to find the variable type on a coloumn

  • I have changed the variable type on a DB from INT to BIGINT.

    Now i need to update app. 200 databases, which of cause will be done wih some ALTER TABLE [talemamel] ALTER COLOUMN [Coloumnname] BIGINT (Right?)

    To do that, i need to get the variable type in a Query - Which query returns the variable type?

    Any help will be appriciated.

    Edvard Korsbæk

  • You can use this query get the column names and it's data types..

    SELECT TABLE_NAME , COLUMN_NAME , DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS

    I honestly dint understand your requirement..

  • Thanks!

    SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = 'TimeAccountMovement' and COLUMN_NAME = 'Minutes'

    If the answer on this query is 'int' i need to update my db

    If it is 'bigint' the db is updated.

    In the field 'minutes' i save the total of 1/100 seconds an employee has worked in his lifetime - That can grow big!

    Edvard Korsbæk

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply