---
title: "How to  get field name with datatype and size In sql Query"  
description: "How to  get field name with datatype and size In sql Query"  
author: "Anonymous User"  
published: 2016-03-03  
updated: 2016-03-03  
canonical: https://www.mindstick.com/forum/34028/how-to-get-field-name-with-datatype-and-size-in-sql-query  
category: "mssql server"  
tags: ["sql server"]  
reading_time: 1 minute  

---

# How to  get field name with datatype and size In sql Query

We want to get [field](https://www.mindstick.com/forum/160867/does-mindstick-provide-training-for-field-marketing) [name](https://yourviews.mindstick.com/view/87450/how-to-generate-a-brand-name-using-linkedin-comprehensive-guide) with [datatype](https://www.mindstick.com/forum/160266/explain-the-datatype-data-annotation-and-its-significance-in-data-entry-and-display) and [size](https://www.mindstick.com/forum/159799/how-can-you-manage-the-size-of-mdf-and-ldf-files) In [sql Query](https://www.mindstick.com/forum/529/rename-table-name-and-column-name-using-sql-query). How will do this please help me.

## Replies

### Reply by Anonymous User

```
CREATE TABLE [dbo].[Employee] (
    [EmpNo]       INT  IDENTITY (1, 1) NOT NULL,
    [EmpName]     VARCHAR (50) NOT NULL,
    [Salary]      DECIMAL (18) NOT NULL,
    [DeptName]    VARCHAR (50) NOT NULL,
    [Designation] VARCHAR (50) NOT NULL,
    PRIMARY KEY CLUSTERED ([EmpNo] ASC)
);
```

```
SELECT column_name as 'Column Name', data_type as 'Data Type',
character_maximum_length as 'Max Length'
FROM information_schema.columns
WHERE table_name = 'Employee'
```

```

```


---

Original Source: https://www.mindstick.com/forum/34028/how-to-get-field-name-with-datatype-and-size-in-sql-query

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
