Sql

Asked • 04/20/19

SQL server query to get the list of columns in a table along with Data types, NOT NULL, and PRIMARY KEY constraints?

I need to write a query on SQL server to get the list of columns in a particular table, its associated data types and their length and if they are not null. I have managed to do this much. But now i also need to get in the same table against a column - TRUE if it is a primary key. How do i do this ? This is how the output should be: `Columns_name----Data type----Length----isnull----Pk` please help me!

1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.