Find out what type of Encoding was used

Asked

Viewed 18 times

0

Is there a way to find out what kind of encoding was used for a table field? I need to maintain a system, but I wanted to know if you have how to use sql server.

  • "encoding" means the data type or character set?

1 answer

1


If "encoding" refers to data types, there are several ways.

You can use SQL_VARIANT_PROPERTY, when you enter "Basetype" in the parameter Property.

-- código #1
CREATE TABLE Super (Nome varchar(50), Idade smallint, Salário money);
INSERT into Super values ('Aparício', 18, 2000);

SELECT top (1) sql_variant_property (Nome, 'BaseType'),
       sql_variant_property (Idade, 'BaseType'),
       sql_variant_property (Salário, 'BaseType')
  from Super;

You can also use INFORMATION_SCHEMA.

-- código #2
CREATE TABLE Super (Nome varchar(50), Idade smallint, Salário money);

SELECT COLUMN_NAME, DATA_TYPE
 from INFORMATION_SCHEMA.COLUMNS
 where TABLE_NAME = 'Super';

Details in System Information Schema Views.


But the best way is by the visual editor of Management Studio (or another similar tool).

  • would it be abuse to ask for the syntax of this command in sql server? I’m pretty new at this

  • Thanks, but this command shows me only the type of fields, does not show the encoding, if it is md5, sha1

Browser other questions tagged

You are not signed in. Login or sign up in order to post.